# trie-route

> This is a simple implementation of router by using Trie data structure at core. It has a basic param feature for example the following code are valid.

Latest version **0.0.5** (published 2016-06-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install trie-route
pnpm add trie-route
yarn add trie-route
bun add trie-route
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.5 |
| Published | 2016-06-14 |
| First published | 2015-10-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Ali Najafizadeh |
| Maintainers | alinz |

## Links

- npm: https://www.npmjs.com/package/trie-route
- npm.io page: https://npm.io/package/trie-route

## Dependencies (1)

- [trie-map](https://npm.io/package/trie-map.md) 0.0.2

## Recent versions

- 0.0.5 (latest) — 2016-06-14
- 0.0.4 — 2016-03-22
- 0.0.3 — 2015-10-26
- 0.0.2 — 2015-10-26
- 0.0.1 — 2015-10-13

## README

# yet another router implementation with trie at core

This is a simple implementation of router by using Trie data structure at core.
It has a basic param feature for example the following code are valid.

```
/users/:id
/users/:id/friends
```

here's an example code:

```js
var route = require('trie-route');

var router = route.create();

router.path('/users/:id', function (params) {
  console.log('this is /users/:id path');
  console.log("here's the list of params", params);
});

router.path('/users/:id/friends', function (params) {
  console.log('this is /users/:id/friends path');
  console.log("here's the list of params", params);
});

var error = router.process('/users/14');
console.log('error:', error);

error = router.process('/users/14/enemies');
console.log('error:', error);
```


## Release Note

### 0.0.5

- added opt in `router.process(path, opt)`. `opt` will be pass to callback as 3rd argument.

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