You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

trie-route

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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.

0.0.5
latest
npmnpm
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

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:

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.

FAQs

Package last updated on 14 Jun 2016

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.