koa-server-timing
Koa 2 Server-Timing
header middleware.
Installation
$ npm install koa-server-timing
API
const Koa = ;const app = ;app; ctxstatetimings /* ... do some long task to measure here */ctxstatetimings;
Options
total
where do you want to see total processing time in Server-Timings
Example
const timings = ;const koa = ;const db = ;const app = ; app; app; console; app
Why
- Small, no dependencies, 100% test coverage
- Uses
process.hrtime
, so, no extra timers and very precise
See also
- See
@thomasbrueggemann/node-servertiming
for non-Koa version that uses Timers
License
MIT