koa-response-time
X-Repsonse-Time middleware for koa
Last updated 2 years ago by coderhaoxin .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install koa-response-time 
SYNC missed versions from official npm registry.

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

Current Tags

  • 2.1.0                                ...           latest (2 years ago)
  • 2.0.0                                ...           next (5 years ago)

5 Versions

  • 2.1.0                                ...           2 years ago
  • 2.0.0                                ...           5 years ago
  • 1.0.2                                ...           7 years ago
  • 1.0.1                                ...           7 years ago
  • 1.0.0                                ...           7 years ago
Downloads
Today 0
This Week 27
This Month 641
Last Day 27
Last Week 220
Last Month 698
Dependencies (0)
None
Dev Dependencies (10)

Copyright 2014 - 2016 © taobao.org |