0.0.4 • Published 5 years ago

egg-xss v0.0.4

Weekly downloads
7
License
ISC
Repository
github
Last release
5 years ago

egg-xss

NPM version build status Test coverage npm

Egg's XSS

Install

$ npm i egg-xss --save

Usage

// {app_root}/config/plugin.js
exports.xss = {
  enable: true,
  package: "egg-xss"
};

Configuration

// {app_root}/config/config.default.js
'use strict';
 config.xss = {
    enable: true,
    match: [ '/test', '/login' ],
  };

see config/config.default.js for more detail.

Example

// app/router.js
"use strict";

module.exports = app => {
  app.get('/test',app.controller.test.index);
};
// app/controller/test.js
("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