2.7.1 • Published 8 months ago
@ditsmod/router v2.7.1
@ditsmod/router
This is a fork of koa-tree-router.
Install
yarn add @ts-stack/di @ditsmod/router
# OR
yarn add @ts-stack/di @ditsmod/router
Where @ts-stack/di is a dependencie.
Usage
import { Router, Tree } from '@ditsmod/router';
import { ReflectiveInjector } from '@ditsmod/core'; // This is a dependency
const injector = ReflectiveInjector.resolveAndCreate([Tree, Router]);
const router = injector.get(Router) as Router;
router.on('GET', '/', () => { /* Here some handler */ });
const { handle, params } = router.find('GET', '/');
Benchmarks
git clone git@github.com:ditsmod/ditsmod-plugins.git
cd ditsmod-plugins/src/router
yarn
yarn boot
yarn build
yarn bench
Results on 22.02.2020:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Running in random order
============================================================
Lib | Bench, ops/sec | Memory usage, KB
============================================================
@ditsmod/router | 4,372,262 | 4,420
------------------------------------------------------------
koa-tree-router | 4,257,653 | 4,281
------------------------------------------------------------
trek-router | 3,416,613 | 4,758
------------------------------------------------------------
find-my-way | 2,512,956 | 4,940
------------------------------------------------------------
2.7.0
8 months ago
2.6.0
9 months ago
2.7.1
8 months ago
2.6.0-beta.1
9 months ago
2.6.0-beta.2
9 months ago
2.5.0
1 year ago
2.4.1
1 year ago
2.4.0
1 year ago
2.4.2
1 year ago
2.3.0
2 years ago
2.2.0
2 years ago
2.0.0
2 years ago
2.0.0-beta.2
2 years ago
2.0.0-beta.1
2 years ago
2.0.0-next.0
2 years ago
1.0.0
3 years ago
1.0.0-beta.4
3 years ago
1.0.0-beta.3
3 years ago
1.0.0-beta.2
3 years ago
1.0.0-beta.1
3 years ago