-
Notifications
You must be signed in to change notification settings - Fork 12
API Documentation
tkaixiang edited this page Aug 20, 2021
·
5 revisions
Last updated on 19/8/2021
Please check out the sidebar on the right for information on endpoints!
The API runs on (localhost) port 20001
.
Please check the CORS settings in api.js
. By default, CORS is set to allow access from any origin.
// Example cors setting if you want to restrict access
app.use(cors({
credentials: true,
origin: 'http://localhost'
}));
MongoDB Validation & Indexes are inserted automatically at the start if they are not detected inside the DB. Please edit validators.js
and the indexes at the start if you would like to change anything.
Response | Definition |
---|---|
{"success": true} |
The request was successfully completed |
{"success": false, "error": "ERROR_CODE"} |
The request was unsuccessful due to the error stated in error
|
Error | Error Code | Definition |
---|---|---|
unknown |
500 | The reason for the failure is not documented |
missing-token |
401 | The request did not send an Authorization header, but the endpoint is authenticated |
wrong-token |
401 | The token sent has either expired or been tampered with |
permissions |
403 | The user does not have sufficient permissions to run the operation |
validation |
400 | The input was malformed |
All authenticated endpoints require an Authorization
header with the token retrieved from the login endpoint.