JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 17674
  • Score
    100M100P100Q138630F
  • License MIT

This module can add `ServerTiming` Header to http response, and be able to use express middleware

Package Exports

  • server-timing

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (server-timing) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

server-timing

Build Status Coverage Status

This module adds Server-Timing to response headers.

You can use this as a express module / basic http function.

Install

$ npm install server-timing -S

Usage

const express = require('express')
const serverTiming = require('server-timing')

const app = express()
app.use(serverTiming())

app.use((req, res, next) => {
  res.setMetric('db', 100.0, "Database metric");
  res.setMetric('api', 200.0, "HTTP/API metric");
  res.setMetric('cache', 300.0, "cache metric");
  next();
});

Result

image