hapi-namespace
express-namespace
Add namespace prefixes to Hapi routes, likeInstall
Install from npm:
npm i --save hapi-namespace
Then require in your routing file:
var namespace =
Usage
namespace(prefix, routes)
prefix
is a string
routes
is an array of hapi route objects
Returns an array of routes, with the prefix prepended to each path.
Here's an example usage:
// This file is users/routes.js 'use strict' var handlers = var namespace = moduleexports =
This will export these routes:
GET '/users'
POST '/users'
GET '/users/{id}'
PUT '/users/{id}'
DELETE '/users/{id}'
Tests
Use npm test
to run the unit tests.