README
Checkup Routes Hapi Plugin
Default health check routes for hapi microservices.
- Dependency Injection compatible (and required!).
- Flow strictly typed.
- Includes Unit and Integration tests.
- Exports as a Hapi Plugin Factory.
Installation
npm install
Usage
npm install --save-optional git+ssh://git@gitlab.clevyr.com:microservices/checkup-routes.git
First add the module to your DI Container.
// di.js (Or your dependency injection definition file)
// ... represents more code that isn't included here.
// Automatically registers checkModel, checkRoute, and checkupPluginRoutes with the diContainer.
const checkupRoutesPluginFactory = require('checkup-routes')(diContainer);
...
diContainer.register('checkupRoutesPlugin', checkupRoutesPluginFactory);
Then inject the plugin and register it with Hapi.
// server.js (Or your hapi server setup file)
// ... represents more code that isn't included here.
module.export = function serverFactory(...checkupRoutesPlugin...) {
...
server.register([...checkupRoutesPlugin...], ...
...
};
module.exports.$inject = [...'checkupRoutesPlugin'...];
Tests
The tests use the ava framework.
npm test
Linters
Lint config files included at root of project:
- .eslintrc, .eslintignore
- .jscsrc
// ESLint
npm install -g eslint
eslint src
- or -
npm run lint
// JSCS
npm install -g jscs
jscs src