Skip to content

Latest commit

 

History

History
58 lines (37 loc) · 1.45 KB

README.md

File metadata and controls

58 lines (37 loc) · 1.45 KB

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