Skip to content

Frapwings/fendjs-router-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fendjs-router-server

Build Status Coverage Status NPM version Dependency Status

Fend.js router for server

Installation

$ npm install fendjs-router-server

Example

var connect = require('connect');
var http = require('http');
var ServerRouter = require('fendjs-router-server');

var router = new ServerRouter();
router.route('get', '/', function () {
  this.res.end('home');
});
router.router('get', '/users/:name', function () {
  this.res.end('foo');
});

var app = connect()
  .use(router.middleware)

http.createServer(app).listen(3000);

API

ServerRouter(options)

Initialize a new ServerRouter with the given options.

ServerRouter#middleware

Return connect middleware.

Testing

$ npm install
$ make test

License

MIT license.

See the LICENSE.

Bitdeli Badge