npm.io
3.0.1 • Published 6 years ago

@travi/hapi-html-request-router

Licence
MIT
Version
3.0.1
Deps
1
Size
7 kB
Vulns
0
Weekly
0

hapi-html-request-router

hapi plugin to direct html requests to a single route

Build Status

Usage

npm license

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

Commitizen friendly semantic-release Greenkeeper badge

Install dependencies
$ nvm install
$ npm install
Verification
$ npm test

Keywords