@travi/hapi-html-request-router

3.0.1 • Public • Published

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

Package Sidebar

Install

npm i @travi/hapi-html-request-router

Weekly Downloads

64

Version

3.0.1

License

MIT

Unpacked Size

7.52 kB

Total Files

7

Last publish

Collaborators

  • travi