Skip to content

Instantly share code, notes, and snippets.

@andywer
Created July 7, 2016 18:38
Show Gist options
  • Save andywer/89f7de284ba15bf4961c1429aca3745c to your computer and use it in GitHub Desktop.
Save andywer/89f7de284ba15bf4961c1429aca3745c to your computer and use it in GitHub Desktop.
Resticle low-level API usage idea
import { createApi } from 'resticle'
import { httpOptions } from 'resticle-middlewares'
const api = createApi()
api.use(httpOptions({
Authorization: 'Bearer someSuperSecretToken'
}))
playAroundWithTheApi()
async function playAroundWithTheApi () {
const users = await api.GET('/users')
await api.POST('/heart-beat', { stillThere: true })
console.log(`There are currently ${users.length} users.`)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment