Load API Data from Django Routes in a Vanilla JavaScript Application

If you [serve a client side application from Django] and you implement API endpoints in the same Django project, you can simply use the URL's path to load data. (See [Using Google BigQuery from Django] for an example.)

async function fetchData() {
  const xhr = await fetch('/api/ny-taxi-tables')
  const json = await xhr.json()
  // use json!
}