Skip to content

Latest commit

History

31 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

node-r3

node-r3 is a native binding of c9s/r3 routing library, please check it for more information.

Installation

$ npm install node-libr3

Testing

$ npm test

Benchmarking

$ npm run benchmark

Examples

API

r3=require("node-libr3");n=newr3.Tree(10);route_data=3;n.insert("/bar",route_data);n.insert("/zoo",route_data);n.insert("/foo/bar",route_data);n.insert("/post/{id}",route_data);n.insert("/user/{id:\\d+}",route_data);n.compile();//should be 3console.log(n.match("/foo/bar"));

Routing with conditions

r3=require("node-libr3");n=newr3.Tree(10);route_data=3;n.insertRoute(r3.METHOD_GET|r3.METHOD_POST,"/blog/post",route_data);n.compile();e=newr3.MatchRoute("/blog/post");//e.requestMethod is r3.METHOD_GET by defaulte.requestMethod=r3.METHOD_GET;//should be 3console.log(n.matchRoute(e));

Alternative

There is another othree/node-r3 project use different approach to let node can use r3's feature.

License

This software is released under MIT License.

About

node-r3 is a native binding of c9s/r3 routing library, please check it for more information.

Resources

Stars

7 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages