Restful API接口规范
官网传送门
JWT用户身份认证
npm i -S jsonwebtoken
使用:
const jwt = require('jsonwebtoken');
// 生成token
const token = jwt.sign({foo: 'hellow'}, '私钥', {expiresIn: '有效期'}); // type: string
// 验证
const jwts = jwt.verify(token, '私钥'); // {foo: 'hellow', iat: 有效时间戳}