Skip to content

timing()

app.timing([options])
NameTypeDescription
optionsObjectOptional configuration object.
options.headerNamestringCustom header name (default: 'Server-Timing').
options.precisionnumberDecimal places for duration in milliseconds (default: 2).

This middleware tracks the total time taken to process a request and returns it in the response via the Server-Timing header, complying with the W3C specification.

Modern browsers automatically parse this header and display backend execution times in their Network Developer Tools.

// Default usage
app.timing();
// With 4 decimal places of precision
app.timing({
precision: 4
});

Format:

Server-Timing: total;dur=12.34