You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This module creates a middleware that records the response time for
requests in HTTP servers. The "response time" is defined here as the
elapsed time from when a request enters this middleware to when the
headers are written out to the client.
Create a middleware that adds a X-Response-Time header to responses. If
you don't want to use this module to automatically set a header, please
see the section about responseTime(fn).
Options
The responseTime function accepts an optional options object that may
contain any of the following keys:
digits
The fixed number of digits to include in the output, which is always in
milliseconds, defaults to 3 (ex: 2.300ms).
header
The name of the header to set, defaults to X-Response-Time.
suffix
Boolean to indicate if units of measurement suffix should be added to
the output, defaults to true (ex: 2.300ms vs 2.300).
responseTime(fn)
Create a new middleware that records the response time of a request and
makes this available to your own function fn. The fn argument will be
invoked as fn(req, res, time), where time is a number in milliseconds.