Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

route-trie

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

route-trie

A trie-based URL router

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
497
decreased by-16.33%
Maintainers
1
Weekly downloads
 
Created
Source

route-trie v0.1.0 Build Status

A trie-based URL router.

trie

Trie-based request routing

** It is a different implementation from routington**

route-trie is a trie-based URL router. Its goal is only to define and match URLs. It does not handle methods, headers, controllers, views, etc., in anyway. It is faster than traditional, linear, regular expression-matching routers, although insignficantly, and scales with the number of routes.

The purpose of this router isn't for performance, but to bring more structure to URL routing. The intention is for you to build a framework on top either in node.js or in the browser.

Implementations:

Browser Support

IE9+

Demo

Installation

Node.js:

npm install route-trie

Bower:

bower install route-trie

API

var Trie = require('route-trie');

Trie([flagI])

var trie = new Trie();
var trie = new Trie(true);

Trie.prototype.define(pattern)

var node = trie.define('/:type/:id([a-z0-9]{6}');

Trie.prototype.match(path)

var match2 = trie.mathc('/post');
// assert(match === null);

var match = trie.mathc('/post/abc123');
// assert(match.node === trie.define('/:type/:id([a-z0-9]{6}'));
// assert.deepEqual(match.params, {type: 'post', id: 'abc123'})

Keywords

FAQs

Package last updated on 10 Dec 2014

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