Common functionality (routes, plugins, config, etc) for projects using hapi.
npm install @leisurelink/hapi-core#hapi-core
Common functionality (routes, plugins, config, etc) for projects using hapi.
##Setup
If you use the yeoman hapi generator no setup outside of configuration is needed.
If not, run:
```
npm install @leisurelink/hapi-core -S
##API
Hapi-core provides default plugin and route registration during server startup.
###init
With this function, you can pass in your hapi server and a config object in order to automagically get common plugins, routes, etc
added to your server.
Take a look at the serverConfig defaults here
Typical registry will look like:
`javascripterror during server setup: ${err}
hapiCore.init(server, serverConfig)
.then(()=>{
server.start();
})
.catch(err=>{
console.error();`
});
You can take a look at the example app here
...
generateHealthCheckResponse: (req, rep)=>{
return {
status: 'ok',
rabbit:{
status: 'ok'
}
};
}
``