egg-rewriter
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

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

Package Sidebar

Install

npm i egg-rewriter

Weekly Downloads

1

Version

1.0.4

License

MIT

Unpacked Size

5.8 kB

Total Files

7

Last publish

Collaborators

  • gaoletian