Created
July 7, 2016 18:38
-
-
Save andywer/89f7de284ba15bf4961c1429aca3745c to your computer and use it in GitHub Desktop.
Resticle low-level API usage idea
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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