@travi/hapi-html-request-router
v3.0.1
Published
hapi plugin to direct html requests to a single route
Downloads
319
Readme
hapi-html-request-router
hapi plugin to direct html requests to a single route
Usage
Installation
$ npm install @travi/hapi-html-request-router
Register with your Hapi v17 server
Include this plugin in the manifest of your
hapi application to direct all requests for text/html
to a
(not included) /html
route.
export default {
server: {port: process.env.PORT},
register: {
plugins: [
{plugin: '@travi/hapi-html-request-router'}
]
}
}
Options
excludedRoutes
Sometimes you don't want all routes to be re-routed to the /html
route.
Provide a list of routes as strings or regex patterns to exclude them from
being re-routed.
export default {
server: {port: process.env.PORT},
register: {
plugins: [
{
plugin: '@travi/hapi-html-request-router',
options: [
'/login',
'/logout',
'/foo/*',
/\/bar\/.*/
]
}
]
}
}
Contribution
Install dependencies
$ nvm install
$ npm install
Verification
$ npm test