Home > front end >  ExpressJS Swagger UI Display Request Duration
ExpressJS Swagger UI Display Request Duration

Time:08-26

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?

CodePudding user response:

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 } }));

  • Related