create-router.js 425 B

1234567891011121314151617
  1. import loggerPlugin from 'router5-plugin-logger'
  2. import browserPlugin from 'router5-plugin-browser'
  3. import routes from './routes'
  4. const r5 = require('router5')
  5. export default function configureRouter() {
  6. const router = r5.createRouter(routes, {
  7. defaultRoute: 'browser',
  8. caseSensitive: true,
  9. urlParamsEncoding: 'uri'
  10. })
  11. router.usePlugin(loggerPlugin)
  12. router.usePlugin(browserPlugin())
  13. return router
  14. }