A Fake REST API using json-server with JWT authentication.
Implemented End-points: login,register
Node 18/20
$ npm install
Dependency imports/resolving doesn't work with json-server v1.0 + so I'm using ^0.x
node server.js
or
npx json-server --watch database.json --port 3000
You can login/register by sending a POST request to
POST http://localhost:8000/auth/login
POST http://localhost:8000/auth/register
with the following data
{
"email": "[email protected]",
"password":"nilson"
}
You should receive an access token with the following format
{
"access_token": "<ACCESS_TOKEN>"
}
You should send this authorization with any request to the protected endpoints
Authorization: Bearer <ACCESS_TOKEN>