0.0.8 • Published 6 years ago

hapi-bootstrap v0.0.8

Weekly downloads
-
License
ISC
Repository
-
Last release
6 years ago

Hapi bootstrap helper

Requires a project to be in a following setup

- project root
    - server
        - plugins
            hapi-plugin-1.plugin.js
            ...
        - jobs
            job-1.job.js
            ...
        - startup
            startup-1.onstartup.js

To initialize a hapi server use

const bootstrap = require('hapi-bootstrap').bootstrap
const server = new Hapi.Server()

...

bootstrap(server).then(server => {
    ...
    server.start(...)
})

Bootstrap process attaches a variable to the server instance determining the startup state o the server server.bootstrap.finished. If this variable is true then the server is fully initialized and all startup scripts have finished their execution. Additionally to this variable an event is emitted when initialization is finished:

server.bootstrap.on('finished', () => {})

Authentication

If default authentication is used, please provide the selected strategy as a server variable:

server.decorate('server', 'defaultAuth', '[INSERT DEFAULT STRATEGY NAME HERE]')

This information will be used for adding OPTIONS routes and determining whether a route is authorized or not

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago