Skip to content

DelkTsai/api-server

 
 

Repository files navigation

api-server

Build Status Dependency Status devDependency Status Code Style

A JSON file RESTful API with authorization based on json-server

Usage

# 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

JWT Authorization

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>' }
}

License

MIT © 汪磊 & WEDN.NET

About

A JSON file RESTful API with authorization based on json-server

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%