重定向

#live demo #source code

重定向需要用到 router.route('*')

import SMERouter from 'sme-router'

const router = new SMERouter('router-view')

router.route('/index', (req, res, next) => {
  res.render('hallo world')
})

router.route('*', (req, res, next) => {
  res.redirect('/index')
})

router.go('/other') // will be redirected to /index
上次更新: 2018-8-10 01:49:32