You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

koa-response-time

Package Overview
Dependencies
Maintainers
8
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

koa-response-time

X-Repsonse-Time middleware for koa

2.1.0
latest
Source
npmnpm
Version published
Weekly downloads
7.5K
19.33%
Maintainers
8
Weekly downloads
 
Created
Source

koa-response-time

Greenkeeper badge

X-Response-Time middleware for Koa.

Installation

$ npm install koa-response-time

Usage

Basic usage:

const Koa = require('koa');
const responseTime = require('koa-response-time');
const app = new Koa();

app.use(responseTime());

If you need response high resolution in nano time, set hrtime option to true:

app.use(responseTime({ hrtime: true }));

Sample response header with hrtime = false (default):

X-Response-Time: 153ms

Sample response header with hrtime = true:

X-Response-Time: 153.123581ms

Note

Best to .use() at the top before any other middleware, to wrap all subsequent middleware.

License

MIT

Keywords

koa

FAQs

Package last updated on 27 Nov 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts