scottie1984 / swagger-ui-express

Adds middleware to your express app to serve the Swagger UI bound to your Swagger document. This acts as living documentation for your API hosted from within your app.
MIT License
1.42k stars 225 forks source link

Swagger UI is slow/unresponsive most of the time. #263

Closed dir closed 2 years ago

dir commented 3 years ago

I am able to serve the UI perfectly fine, but when I try and click on various things, i.e. opening an endpoint, it doesn't open on 95% of my clicks, same goes for the rest of the features. Overall just super slow and buggy on my end for some reason.

Here is my code:

const express = require('express');
const app = express();
const swaggerUi = require('swagger-ui-express');
const swaggerDocument = require('./_build/swagger.json');

const port = 3000

app.use('/', swaggerUi.serve, swaggerUi.setup(swaggerDocument));

app.listen(port, () => {
    console.log(`Swagger UI listening at http://localhost:${port}`)
})

I also seem to be getting these errors in console a bit: Screen Shot 2021-07-15 at 1 18 22 PM

dir commented 3 years ago

So far I have tried, uninstalling and reinstalling swagger-ui-dist and swagger-ui-express, I have also tried changing my endpoint on app.use() from / to /docs to no avail.

dir commented 3 years ago

Just enabled "explore", also incredibly slow/buggy as well. I have one endpoint in this entire application and it just infinite loads.

scottie1984 commented 2 years ago

Is your swagger document correct? It seems to be complaining about an Invalid base URL.

I will close for now - please reopen if needed