Socket
Socket
Sign inDemoInstall

koa-response-time

Package Overview
Dependencies
0
Maintainers
8
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

koa-response-time

X-Repsonse-Time middleware for koa


Version published
Weekly downloads
8.1K
increased by33.92%
Maintainers
8
Install size
3.69 kB
Created
Weekly downloads
 

Readme

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

FAQs

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc