1.0.0 • Published 6 years ago

errorh v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

errorh

Build Status Coverage Status Code Climate NPM Version NPM Downloads Dependency Status Known Vulnerabilities NSP Status

Custom static error pages for Hapi. This plugin depends on inert to function.

Similarly, please ensure that the route files are configured. A static file route must already be in place.

If not, you may use the staticRoute option to specify one.

Usage

// configuring route files
const server = new Hapi.Server({
    connections: {
        routes: {
            files: {
                relativeTo: '/path/to/files'
            }
        }
    }
});

// registering the plugin
server.register({
    register: require('errorh'),
    options: {
        errorFiles: {
            404: '404.html',
            default: '50x.html'
        },
        staticRoute: {
             path: '/{path*}',
             method: '*',
             handler: {
                 directory: {
                     path: './',
                     index: true,
                     redirectToSlash: true
                 }
             }
        }
    }
}, (err) => {
    ...
});

Glue manifest

registrations: [
    {
        plugin: {
            register: 'errorh',
            options: [
                ...
            ]
        }
    }
]

Options

  • errorFiles - object containing the status code to file config.
  • staticRoute - route object for setting up the inert static directory handler.

You can disable the plugin on a specific routes through config: { plugins: { errorh: false } }.

Contributing

1.0.0

6 years ago

0.2.1

8 years ago

0.2.0

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago