This repository contains a mock API created based on db.json file.
I'm using json-server ❤️
API supports 2 version, both operating on the same dataset - one requires authentication, second does not. If you are not sure how to use it - no problem, please read this README carefully to the end 😊
Simply
npm install
npm start
- The server by default is visible under
localhost:3030
No prefixes, just go to url, f.e.: GET ~/notes
Under version 2, use v2
prefix, f.e.: GET ~/v2/notes
Simple demo authorization supports only one user - Mr/Mrs/Miss Admin Admin. In response you will get JWT bearer token, always this hardcoded one.
Request
POST ~/v2/login
payload:
{
"username": "admin",
"password": "admin"
}
headers:
content-type: application/json`
Response
- success
200
{
"name": "Admin Admin",
"token": {the token}
}
- failure (no credentials or wrong credentials)
400
Add Authorization
header with bearer token
Example:
HEADERS:
Authorization: Bearer eyJ0eXA...