0.1.2 • Published 11 years ago

trafficlights v0.1.2

Weekly downloads
2
License
MIT
Repository
github
Last release
11 years ago

Routes

Routes NPM

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.

0.1.2

11 years ago

0.1.1

11 years ago

0.1.0

11 years ago