any-router
v1.1.1
Published
Routing Anything
Downloads
2
Readme
Example
also see: example/index.js
import anyRouter from 'any-router';
const router = new anyRouter();
router.use(async (state, next) => {
const start = Date.now();
await next();
const ms = Date.now() - start;
console.log(`${ms}ms`);
});
router.use(async (state, next) => {
await next();
// final processing here... (ex: send)
});
router.add('ping', (state, next) => {
state.ping = 'pong';
next();
});
const url = 'ping';
router.route(url, {
globalState: 'something'
});
License
- code: MIT
- icon: Icon made by Smashicons from www.flaticon.com