trafficlights

0.1.2 • Public • Published

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.

Readme

Keywords

Package Sidebar

Install

npm i trafficlights

Weekly Downloads

2

Version

0.1.2

License

MIT

Last publish

Collaborators

  • jfkingsley