🌜
🌞
beidou-router

beidou-router

v2.0.1

beidou auto router

npm install beidou-router

README

Beidou Router

Auto Router for Beidou framework

Install

$ npm install beidou-router --save

Configuration

  • config/plugin.js:
exports.router = {
  enable: true,
  package: 'beidou-router',
};
  • config/config.default.js
/**
 * Router options
 * @member Config#router
 */
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 ignored
   * 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

Release Notes

1.0.0
By Qing • Published on March 23, 2018

BREAKING CHANGE

  • Node version must >= 8
  • React/react-dom versions must >= 16
  • Replace koa-webpack-dev-middleware with webpack-dev-server
  • Remove app.helper.resolveResource, use app.helper.asset instead

Features

  • Upgrade to [email protected], support async/await style middlewares
  • All in one manage tool - beidou-cli, including init boilerplate, development, debug, test, build assets, start/stop production app, and so on.
  • Custom view rendering process by view middlewares
  • Support rax isomorphic rendering, see beidou-view-rax
  • Webpack support many frontend resource loaders, see code
  • Webpack support CSS Modules with .module.{css|scss|less} files
  • Dump webpack config to [root]/run directory
  • Custom babel client targets by configuration
  • Handle many reasonable default configs, you may not need a lot of options in your config files, see examples

General

License
MIT
Typescript Types
None found
Tree-shakeable
No

Popularity

GitHub Stargazers
2,732
Community Interest
3,110
Number of Forks
280

Maintenance

Commits
10/219/2202
Last Commit
Open Issues
15
Closed Issues
127
Open Pull Requests
36
Closed Pull Requests
56

Versions

Versions Released
10/219/2201
Latest Version Released
Jan 29, 2019
Current Tags
latest2.0.1
next2.0.0-beta.0

Dependencies

Dependencies (2)
Dev Dependencies (5)

Contributors

njugray
njugray
Commits: 221
weichunpeng
weichunpeng
Commits: 162
devrsi0n
devrsi0n
Commits: 86
justquanyin
justquanyin
Commits: 26
ahungrynoob
ahungrynoob
Commits: 9
xdlrt
xdlrt
Commits: 2
JacksonTian
JacksonTian
Commits: 2
olivewind
olivewind
Commits: 1
chenmingjia
chenmingjia
Commits: 1
davidnotes
davidnotes
Commits: 1
weihomechen
weihomechen
Commits: 1
lanqy
lanqy
Commits: 1
fantasyroot
fantasyroot
Commits: 1
xiangxingchen
xiangxingchen
Commits: 1
kittBoy
kittBoy
Commits: 1