UNPKG

fh-request-timer

Version:

Express middleware to add a timer to all requests, sending the result to RHMAP stats and optionally adding the time taken as a response header

37 lines (27 loc) 677 B
fh-request-timer ======================== A simple request timer middleware for express apps that logs request time to the Red Hat Mobile Application Platform, as well as adding an optional `x-fh-timer` header to each response. Implementation -------------- ``` javascript // require module var reqTimer = require('fh-request-timer'); // include timer middleware app.use(reqTimer()); ``` Configuration -------------- To remove the `x-fh-timer` from the response, pass the option `{addHeader:false}` when calling the middleware: ``` // include timer middleware app.use(reqTimer({addHeader: false})); ``` Run Unit Tests -------------- ``` shell npm install npm test ```