The API is defined in the api.js
file, and all routes can be found in the /routes/
directory.
For example if you want to find the endpoints for the Chat
functionality then can be found in /routes/chat.js
.
API Definition
The API definition is an OpenAPI 3.0 spec, and is published as a website you can access from your dev server here:
http://localhost:1337/api
Koa
The API uses a HTTP router called Koa.
Koa is considered a successor to Express
,
and was designed by the same team.
If you’ve used Express
in the past then Koa will be familiar. The
main difference is that you return data from koa by setting ctx.body
like this:
Calling the API
The API is secured by License Keys. When a user is created or signs up for your app,
they are issued a license key automatically.
This license key can be used to make requests to the API as a Bearer Token in the
Authorization
header.
Here’s an example of making an API request with the license key as a Bearer token from our demos: