New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

trek-router

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

trek-router

A fast HTTP router router

  • 0.0.12
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
111
decreased by-18.38%
Maintainers
1
Weekly downloads
 
Created
Source

trek-router

A fast HTTP router, inspired by Echo's Router.

NPM version Build status Test coverage License Dependency status

Benchmarks

See benchmarks, use GitHub API Routes.

trek-router VS

$ npm run benchmark

trek-router x 2,953 ops/sec ±0.82% (86 runs sampled)
memoryUsage: { rss: 41099264, heapTotal: 27330560, heapUsed: 12131640 }
path-to-regexp x 398 ops/sec ±0.91% (84 runs sampled)
memoryUsage: { rss: 44023808, heapTotal: 31446272, heapUsed: 13515744 }
route-recognizer x 280 ops/sec ±1.81% (79 runs sampled)
memoryUsage: { rss: 63115264, heapTotal: 51041024, heapUsed: 18087664 }
route-trie x 1,098 ops/sec ±1.16% (86 runs sampled)
memoryUsage: { rss: 64200704, heapTotal: 51041024, heapUsed: 20905648 }
routington x 1,156 ops/sec ±1.56% (87 runs sampled)
memoryUsage: { rss: 64397312, heapTotal: 51041024, heapUsed: 12043280 }
Fastest is trek-router

Usage

import Router from 'trek-router';

let r = new Router();
// static route
r.add('GET', '/folders/files/bolt.gif', () => {});
// param route
r.add('GET', '/users/:id', () => {});
// catch-all route
r.add('GET', '/books/*', () => {});

let result = r.find('GET', '/users/233')
// => [handler, params]
// => [()=>{}, [{name: id, value: 233}]]

let result = r.find('GET', '/photos/233')
// => [handler, params]
// => [null, []]

License

MIT

Keywords

FAQs

Package last updated on 07 Apr 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc