ravine
ravine is a simple router middleware for nodejs
with ravine routes are just javascript arrays. use javascript array manipulation functions to construct and manipulate routes.
install
npm install ravine
use
http = require 'http' ravine = require 'ravine' middleware = ravine 'ALL''*' # called before all following routes next 'GET''/' # called only on GET / resend 'hello' 'ALL''/users*' # called before all following routes if the request url starts with /users next 'POST''/users' resend 'post' 'PUT''/users/:id' # called on PUT /users/7 for example. req.params will then be {id: 7} resend 'put ' + reqparamsid 'DELETE''/users/:id' # called on DELETE /users/18 for example. req.params will then be {id: 18} resend 'delete ' + reqparamsid server = httpcreateServer middleware serverlisten 80
see url-pattern for supported url patterns.
the parameters extracted from the url will be available as req.params
.