a micro middleware router that can be used in both client-side (e.g. dot.js, vue, react, preact) and server-side applications (e.g. Node.js/Express, Koa)
- support koa
- support express
- support browser pushState & replaceState
- middleware router, API like express
npm install minrouter
npm run build
# build the web code
npm run demo
# http://localhost:3000
npm run express
or
# http://localhost:4000
npm run koa
or
# http://localhost:4000
npm run preact
see demo directory code
- Router.get(path, fn)
- Router.addResMethod(name, fn)
- Router.go(path, isReplace) only browser
- Router.back() only browser
- Router.proxyLinks(nodes) only browser
- req.query & req.params, this.ctx, this.ctx.res
see src/minrouter.js