@askbills/healthcheck

Check whether A Service alive or not

Usage no npm install needed!

<script type="module">
  import askbillsHealthcheck from 'https://cdn.skypack.dev/@askbills/healthcheck';
</script>

README

Introduction

This package supports checking service whether alive or not.

Capabilities and Frameworks

Capability Module
Server Framework hapi as a web server
API documentation hapi-swagger support self documentation the API interface in the project from code annotations. hapi-swagger will need to install the inert static file and directory handlers plugin for hapi.js, vision templates rendering support for hapi.js
Coding Standard eslint identifying and reporting on patterns found in ECMAScript/JavaScript code completely pluggable, babel-eslint support parsing ECMAScript for eslint
Testing Framework chai a BDD / TDD assertion library for node and browser, mocha test framework, nyc command line interface support checking code coverage

How to test

npm test
npm test:coverage

How to check lint

npm run lint
npm run lintFix

How to use

Install this module check dependencies in package.json

"dependencies": {
    "@askbills/healthcheck": "0.0.1"
  }

Create a service connection object with an api tag.

server.connection([
  {
    address: 'localhost',
    port: 3000,
    labels: ['api']
  }
]);

Add it as an object in plugins array with register healthcheck, check dependencies

const pkg = require('../package.json');
const plugins = [
  inert,
  vision,
  {
    select: ['api'],
    register: hapiSwagger
  },
  {
    select: ['api'],
    register: healthcheck,
    options: {
      pkg: pkg.dependencies,
      config: {
        api: {
          version: '0.0.0'
        }
      }
    }
  }
];

server.register(plugins);