# any-router

> Routing Anything

Latest version **1.1.1** (published 2019-12-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install any-router
pnpm add any-router
yarn add any-router
bun add any-router
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2019-12-09 |
| First published | 2019-12-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | dotPlants HQ |
| Maintainers | yuzulabo |

## Links

- npm: https://www.npmjs.com/package/any-router
- Repository: https://github.com/dotplants/any-router
- npm.io page: https://npm.io/package/any-router

## Recent versions

- 1.1.1 (latest) — 2019-12-09
- 1.1.0 — 2019-12-09

## README

![img](https://i.imgur.com/gWwIGeQ.png)

# Example

also see: [example/index.js](https://github.com/dotplants/any-router/blob/master/example/index.js)

```javascript
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

---
_Source: https://npm.io/package/any-router · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
