trafficlights
v0.1.2
Published
The most awesomest routing system for ExpressJS.
Downloads
4
Readme
Routes
TrafficLights is an awesome, simple routing system for ExpressJS. It is still a work in progress, but at the moment it allows for basic routing.
Install
$ npm install trafficlights
Usage
var trafficLights = require('trafficlights');
var express = require('express');
var server = express();
var routes = [
{
"path" : "/",
"type" : "get",
"controller" : "IndexController"
},
{
"path" : "/health",
"type" : "get",
"controller" : "HealthController"
}
];
trafficlights.registerRoutes(server, routes, options);
server.listen(process.argv.splice(2)[0] || 1337);
And done! It's that simple.
Config
The configurable options are currently limited to "debug", which logs each request, and "controllerPath", which allows you to specify the controller path relative to the app root.
All controller files are required then the function "render" is called on them with parameters of res and req respectively.