Skip to content
This repository has been archived by the owner on Jun 25, 2023. It is now read-only.

dotplants/any-router

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Releases

No releases published

Packages

No packages published