ExpressJS Swagger UI Display Request Duration

Issue

https://swagger.io/docs/open-source-tools/swagger-ui/usage/configuration/

I want to output the request duration and based on the available configurations, the displayRequestDuration is by default false so on my express app, I have added it in the options object but it does not seem to be working

Swagger Options

Is there any examples of how to correctly configure this parameter?

Solution

This answer is only for the use of swagger-jsdoc and swagger-ui-express packages.

The displayRequestDuration can be defined in the swaggerUI.setup() function. For example

app.use("/swagger", swaggerUI.serve, swaggerUI.setup(swaggerDocs, {
swaggerOptions:{
displayRequestDuration: true
}
}));

Answered By – zimmerdimmer

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published