0.2.1 • Published 6 years ago

express-actuator-endpoints v0.2.1

Weekly downloads
216
License
ISC
Repository
github
Last release
6 years ago

Express Actuator Endpoints

This module is an express middleware that exposes endpoints that somewhat mimic the behavior of Spring Boot Actuator

All responses are in JSON format.

Installation

npm i --S express-actuator-endpoints

Usage

import express from "express";
import actuator from "express-actuator-endpoints";

const app = express();
app.use(actuator());

Endpoints

EndpointResponse
/healthResponds with a status of "UP" and a default description
/infoResponds with the last git commit info when used in conjunction with node-git-info-json
/envResponds with process.env

Configuration

You can pass a configuration object to this middleware and the routes will serve any information you pass, along with the defaults. See example below:

import express from "express";
import actuator from "express-actuator-endpoints";

const actuatorConfig = {
  info: {
    gitInfo: "Some git info"
  },
  health: {
    description: "Jim's API"
  }
};

const app = express();
app.use(actuator(actuatorConfig));