wucode-router
v0.12.8
Published
A lightweight router lib that implement with express route style
Downloads
4
Maintainers
Readme
SME Router
安装
npm i --save wucode-router
·
用法
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>wucode-router</title>
</head>
<body>
<div id="root"></div>
</body>
</html>
import WucodeRouter from 'wucode-router'
const router = new WucodeRouter('root')
// route config
router.route('/index', (req, res, next) => {
res.render(`hello world`)
})
router.route('*', (req, res, next) => {
res.redirect('/index')
})