Skip to content

koajs/response-time

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

koa-response-time

Greenkeeper badge

X-Response-Time middleware for koa. Compatible with request-received.

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

About

X-Response-Time middleware

Resources

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published