0.3.2 • Published 6 years ago

beidou-plugin-router v0.3.2

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

Table of Contents generated with DocToc

Beidou Router

Auto Router for Beidou framework

Install

$ npm install beidou-plugin-router --save

Configuration

  • config/plugin.default.js:
exports.router = {
  enable: true,
  package: 'beidou-plugin-router',
};
  • config/config.default.js
  /**
   * View options
   * @member Config#view
   */
  exports.router = {
    /**
     * root directory for auto match route
     * include server route and webpack entry
     * @member {String} Config#root
     * @since 1.0.0
     */
    root: '/',

    /**
     * files or directories should be ingored
     * when automatically match route
     * @member {String} Config#exclude
     * @since 1.0.0
     */
    exclude: '_*',

    /**
     * define custom mapping files to router
     *
     * {
     *  user: {
     *    profile: 'get',
     *    ':id': ['post', 'get'],
     *    
     *  }
     * }
     * 
     */
    mapping: null,

    entry: 'index',
  };

Usage

Straightly visit page located in client directory.

e.g. with default config, access GET: / will render client/index.jsx file.

API

coming soon

License

MIT

0.3.2

6 years ago

0.3.0

6 years ago