Redirect

#live demo #source code

You should use router.route('*') to redirect unmatch url

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
Last Updated: 8/10/2018, 1:49:32 AM