any-router

1.1.1 • Public • Published

img

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

/any-router/

    Package Sidebar

    Install

    npm i any-router

    Weekly Downloads

    2

    Version

    1.1.1

    License

    MIT

    Unpacked Size

    7.03 kB

    Total Files

    21

    Last publish

    Collaborators

    • nzws_me
    • yuzulabo
    • nzws-publisher