fh-request-timer

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

Usage no npm install needed!

<script type="module">
  import fhRequestTimer from 'https://cdn.skypack.dev/fh-request-timer';
</script>

README

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

// 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

npm install
npm test