1.0.4 • Published 6 years ago

egg-rewriter v1.0.4

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

egg-rewriter

Install

$ npm i egg-rewriter --save
# or
$ yarn add egg-rewriter

Usage

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

Configuration

// {app_root}/config/config.default.js
exports.rewriter = {
  // 默认重写到 /index.html
  index: '/index.html',
  // 打印日志
  verbose: true,
  // 白名单正则,默认 /\/api/gi, 符合白名单规则的url一律不重写
  whiteList: /\/api/gi,  
  // 自定义url重写规则,覆盖 index
  rewriteRule: [
      { from: /\/admin/, to: '/admin.html' },
      { from: /\/login/, to: '/login.html' },
  ],
};

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

Example

Questions & Suggestions

Please open an issue here.

License

MIT

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago