0.0.5 • Published 8 years ago

trie-route v0.0.5

Weekly downloads
1
License
MIT
Repository
-
Last release
8 years ago

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.
0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago