Skip to content

An internal status page for Express servers.

License

Notifications You must be signed in to change notification settings

navapbc/server-status-utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Server status utilities

This module provides an internal status page for Express based servers. The status page is aimed for developers and shows useful info for diagnostics or troubleshooting, for example the application version and recent requests.

See an example of the status page.

Usage

To use, first require the module and create a ServerStatus object:

const serverStatus = require("server-status-utils")
const ss = new serverStatus.ServerStatus()

Connect the collectRequestStats handler to track all requests (before all other handlers that may respond to a request). It is safest to put this as the first handler:

app.use("/", ss.collectRequestStats.bind(ss))

Connect the statusPage handler to a specific GET path of your choice. This can be done at any point in your express handlers:

app.get("/status", ss.statusPage.bind(ss))

A usage example is included. To run the example use npm:

npm install
npm run example

Tests

To run the test suite use npm:

npm install
npm test

A coverage report will be produced in the coverage directory.

About

An internal status page for Express servers.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published