trek-router
Advanced tools
Comparing version 0.0.1 to 0.0.3
@@ -62,3 +62,3 @@ "use strict"; | ||
methods.forEach(function (m) { | ||
_this.trees[m] = new Node("", null, null, []); | ||
_this.trees[m.toUpperCase()] = new Node("", null, null, []); | ||
}); | ||
@@ -65,0 +65,0 @@ } |
{ | ||
"name": "trek-router", | ||
"version": "0.0.1", | ||
"version": "0.0.3", | ||
"description": "A fast HTTP router router", | ||
@@ -5,0 +5,0 @@ "repository": "trekjs/router", |
# trek-router | ||
A fast HTTP router, inspired by [Echo](https://github.com/labstack/echo) Router. | ||
A fast HTTP router, inspired by [Echo](https://github.com/labstack/echo)'s Router. | ||
[![NPM version][npm-img]][npm-url] | ||
[![Build status][travis-img]][travis-url] | ||
[![Test coverage][coveralls-img]][coveralls-url] | ||
[![License][license-img]][license-url] | ||
[![Dependency status][david-img]][david-url] | ||
## Benchmarks | ||
trek-router vs [path-to-regexp][] | ||
trek-router vs [path-to-regexp][], see [benchmarks](benchmarks) | ||
@@ -20,12 +27,12 @@ ```bash | ||
// static route | ||
r.add('get', '/folders/files/bolt.gif', () => {}); | ||
r.add('GET', '/folders/files/bolt.gif', () => {}); | ||
// param route | ||
r.add('get', '/users/:id', () => {}); | ||
r.add('GET', '/users/:id', () => {}); | ||
// all star | ||
r.add('get', '/books/*', () => {}); | ||
r.add('GET', '/books/*', () => {}); | ||
let result = r.find('get', '/users/233') | ||
let result = r.find('GET', '/users/233') | ||
// => [()=>{}, [{name: id, value: 233}]] | ||
let result = r.find('get', '/photos/233') | ||
let result = r.find('GET', '/photos/233') | ||
// => null | ||
@@ -39,1 +46,12 @@ ``` | ||
[path-to-regexp]: https://github.com/pillarjs/path-to-regexp | ||
[npm-img]: https://img.shields.io/npm/v/trek-router.svg?style=flat-square | ||
[npm-url]: https://npmjs.org/package/trek-router | ||
[travis-img]: https://img.shields.io/travis/trekjs/trek-router.svg?style=flat-square | ||
[travis-url]: https://travis-ci.org/trekjs/trek-router | ||
[coveralls-img]: https://img.shields.io/coveralls/trekjs/trek-router.svg?style=flat-square | ||
[coveralls-url]: https://coveralls.io/r/trekjs/trek-router?branch=master | ||
[license-img]: https://img.shields.io/badge/license-MIT-green.svg?style=flat-square | ||
[license-url]: LICENSE | ||
[david-img]: https://img.shields.io/david/trekjs/trek-router.svg?style=flat-square | ||
[david-url]: https://david-dm.org/trekjs/trek-router |
10229
56