restify-namespace

0.1.1 • Public • Published

restify-namespace - simple route namespacing

Defining sub-routes is something that happens often. Why keep repeating yourself? restify-namespace makes it easy to define nested route prefixes to DRY up your routes.

Installation

npm install --save restify-namespace

Example

Here is how you might define some routes:

var namespace = require('restify-namespace');
var app = restify.createServer();
namespace(app, '/api', function () {
	app.get('/thingys', thingysHandler);

	namespace(app, '/beep', function () {
		app.get('/boop', plunkHandler);
	});
});

This would create the following routes:

GET /api/thingys
GET /api/beep/boop

Not Implemented

At the moment restify-namespace does not support regular expression subroutes. It will throw to warn you of this.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.1.1
    5
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.1.1
    5
  • 0.1.0
    2
  • 0.0.0
    0

Package Sidebar

Install

npm i restify-namespace

Weekly Downloads

7

Version

0.1.1

License

MIT

Last publish

Collaborators

  • mpareja