# tinyrouter

> router base implementation

Latest version **0.2.7** (published 2018-05-22) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install tinyrouter
pnpm add tinyrouter
yarn add tinyrouter
bun add tinyrouter
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.2.7 |
| Published | 2018-05-22 |
| First published | 2016-09-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 19.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | joje |
| Maintainers | attrs, joje |
| Keywords | router |

## Links

- npm: https://www.npmjs.com/package/tinyrouter
- Repository: https://github.com/attrs/tinyrouter
- Issues: https://github.com/attrs/tinyrouter/issues
- npm.io page: https://npm.io/package/tinyrouter

## Dependencies (2)

- [tinyevent](https://npm.io/package/tinyevent.md) ^0.1.0
- [route-pattern](https://npm.io/package/route-pattern.md) 0.0.6

## Alternatives

- [express-promise-router](https://npm.io/package/express-promise-router.md) — 736.1K weekly downloads
- [next-usequerystate](https://npm.io/package/next-usequerystate.md) — 29.8K weekly downloads
- [@bitkyc08/opencodex](https://npm.io/package/@bitkyc08/opencodex.md) — 4.6K weekly downloads
- [lynkr](https://npm.io/package/lynkr.md) — 575 weekly downloads
- [baremetal.js](https://npm.io/package/baremetal.js.md) — 42 weekly downloads

## Recent versions

- 0.2.7 (latest) — 2018-05-22
- 0.2.6 — 2018-05-22
- 0.2.5 — 2018-05-03
- 0.2.4 — 2017-02-10
- 0.2.3 — 2017-02-10
- 0.2.2 — 2016-12-28
- 0.2.1 — 2016-12-28
- 0.2.0 — 2016-12-27
- 0.1.1 — 2016-12-12
- 0.1.0 — 2016-11-12
- 0.0.2 — 2016-09-30
- 0.0.1 — 2016-09-20
- 0.0.0 — 2016-09-13

## README

# tinyrouter

A tiny router base implementation

[![NPM Version][npm-version]][npm-url] [![NPM Downloads][npm-total]][npm-url] [![NPM Downloads][npm-month]][npm-url] [![NPM Downloads][license]][npm-url]

[npm-version]: https://img.shields.io/npm/v/tinyrouter.svg?style=flat
[npm-url]: https://npmjs.org/package/tinyrouter
[npm-total]: https://img.shields.io/npm/dt/tinyrouter.svg?style=flat
[npm-month]: https://img.shields.io/npm/dm/tinyrouter.svg?style=flat
[license]: https://img.shields.io/npm/l/tinyrouter.svg?style=flat


## Install
```sh
$ npm install tinyrouter --save
```

## Usage
```javascript
var tinyrouter = require('tinyrouter');

var router = tinyrouter()
  .use(function(req, res, next) {
    next();
  })
  .get('/path', function(req, res, next) {
    console.log('path', req.parentURL, req.url, req.currentURL);
    next(new Error('error'));
  })
  .on('error', function(e) {
    console.error(e.detail.error);
  });
  
var req = {
  url: '/path'
};
var res = {};
router(req, res, function(err) {
   console.log('finished');
});
```


### License
Licensed under the MIT License.
See [LICENSE](./LICENSE) for the full license text.

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