Runways - a route dispatcher for connect
Runways is middleware that adds robust explicit routing to connect
connect = require('connect');
router = require('runways');
> routes can be added at any time, but we'll give an example here
> router.add(<name>,<route>,<callback>,<http methods (default: get)>)
> default static route
router.add("default","/",function(req,route) { return "hello, runways" });
> dynamic route with a parameter
router.add("hello","/hello/{name}", function(req,route) { return "hello, " + route.params.get(name) });
> dynamic route with a parameter and a default
router.add("hi", "/hi/{name:there}", function(req,route) { return "hi, " + route.params.get(name) + "!" });
// define our server with our middleware
server = connect.createServer(router.routes());
// start the server
server.listen(3000);
MIT License. See LICENSE.md