egg-jwt2
![Test coverage](https://img.shields.io/codecov/c/gh/deepexi/egg-jwt2.svg?style=flat-square)
Deepexi Egg's JWT(JSON Web Token Authentication Plugin)
Install
$ npm i egg-jwt2 --save
Usage
exports.jwt = {
enable: true,
package: "egg-jwt2"
};
Configuration
'use strict';
exports.jwt = {
enable: true,
match: '/login/1',
};
see config/config.default.js for more detail.
Example
"use strict";
module.exports = app => {
app.get('/test',app.controller.test.index);
app.get('/test',app.middleware.jwt(),app.controller.test.index);
};
("use strict");
module.exports = app => {
class SuccessController extends app.Controller {
index() {
console.log('query body : ', this.ctx.query);
this.ctx.body = this.ctx.query;
}
}
return SuccessController;
};
Questions & Suggestions
Please open an issue here.
License
MIT