Git Product home page Git Product logo

express-health-check's Introduction

express-health-check

A simple middleware that returns the availability of the API and related services.

Getting started

Install with:

npm install --save @sparkit-gmbh/express-health-check

Use it in your express app:

const app = require('express')();
const statusMonitor = require('@sparkit-gmbh/express-health-check');

// Default
app.use(statusMonitor());

// With DB Monitor (Mongoose / Sequelize / IORedis)

// With Custom URL Path
app.use(status({ path: '/api/status', db: true }));

// respond with "hello world" when a GET request is made to the homepage
app.get('/', function(req, res) {
    res.send('hello world');
});

app.listen(3000, function () {
    console.log('Example app listening on port 3000!')
});

Options

Custom URL Path

{ path: '/status'}

API Monitoring: Enable/Disable

{ api: true }

System Monitoring: Enable/Disable

{ system: true }

DB Monitoring: Enable/Disable

{ db: true }

If DB is set to true, a DB instance should be provided

  • Mongoose { mongoose: mongoose }
  • Sequelize { sequelize: sequelize }
  • IORedis { ioredis: ioredisInstance }

DB Monitoring support

  • Mongoose ORM (MongoDB)
  • Sequelize ORM (MySQL, PostgreSQL, SQlite, ...)
  • IORedis (Redis)
  • MongoDB (coming soon)

Extras

You can return any JSON data with the extras property

{
    extras: {
        infoA: 1234
        infoB: 1234
        infoC: 'somethin'
    }
}

Feedback

Suggestions or improvements are most welcomed ! Open an issue if you want to help.

Author

Piraveen Kamalathas https://github.com/piraveen

express-health-check's People

Contributors

piraveen avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.