A JSON file RESTful API with authorization based on json-server
# clone repo
$ git clone https://github.com/zce/api-server.git <my-api>
# change directory
$ cd <my-api>
# install dependencies
$ npm install
modify database.json file
# serve with hot reload at http://localhost:2080
$ npm run dev
with jsonwebtoken
# create token
POST /tokens
{ username: 'zce', password: 'wanglei' }
# check token
GET /tokens
{
header: { Authorization: 'Bearer <jsonwebtoken>' }
}
# revoke token
DELETE /tokens
{
header: { Authorization: 'Bearer <jsonwebtoken>' }
}