Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

express-status-counter

narqo2WTFPL0.1.0

express middleware that counts response by the first digit of its HTTP status codes

connect, express, metrics, status-counter

readme

express-status-counter

Build Status Dependency Status devDependency Status

express middleware that counts response by the first digit of its HTTP status codes.

Install

› npm install -S express-status-counter

Usage

// server.js

var connect = require('connect'),
    statusCounterMiddleware = require('express-status-counter'),
    stats = require('luster').stats;

var app = connect()

// Every response will be counted by `stats` function as `app.stats.status-<N>xx`,
// where `N` is the first digit of HTTP status code.
app.use(statusCounterMiddleware(stats, function getStatusNamePrefix(req) {
    return 'app.stats.status';
}));

Options

stats: Object

getStatusNamePrefix: Function(req: http.IncomingMessage): String

changelog

CHANGELOG

0.1.0

  • Initial public release.
  • Rename to "express-status-counter"

0.0.2 - 2016-02-20

Breaking changes

  • Since now on middleware receives two parameters: stats modules and a function that calculate the name of the metric. See example/server.js for example.

0.0.1 - 2015-12-01

  • Initial release.