Add 'server-timing' headers to your node.js server.
If you're wondering why this would be useful, go check out this article.
There are other libraries out there that do this, but this one is the best. ;)
Features:
- Sub-millisecond accuracy with
process.hrtime()
, but falls back to millisecond accuracy if you're on some weird platform that doesn't haveprocess.hrtime()
. - No server-timing headers by default on prod.
- No dependencies on Express, but provides some handy middleware helpers if you're on Express.
Documentation
See the api docs here.
Examples:
; /* -- Use in express app -- */const app = ;app; // Time some middlewaresapp;app;app;app