swagger-ui-express doesn't show css

91 Views Asked by At

I'm using swagger-ui-express to expose swagger in my Node application. In my localhost, everything is shown well. When I run my application on a Kubernetes POD, I'm missing the styles on the swagger page.

When I inspect the result swagger page (f12) from the server (POD), I can see that I have: "docs" folder with swagger-ui.css file inside, but this css file contains html context instead of css. very strange!

Any idea ? Thanks!

Here is the code I'm using to expose:

    public static exposeSwagger(app: any) {
    const swaggerDefinition = {
      openapi: '3.0.0',
      info: {
        title: 'Express API for JSONPlaceholder',
        version: '1.0.0'
      }
    };

    const options = {
      swaggerDefinition,
      apis: ['./specs/*.yml']
    };

    try {
      const swaggerSpec = swaggerJsDoc(options);
      app.use('/docs', swaggerUi.serve, swaggerUi.setup(swaggerSpec));
    } catch (err) {
      logger.error(err);
    }
  }

Here are my dependencies from package.json: "swagger-jsdoc": "^6.2.8", "swagger-ui-express": "^4.6.3"

0

There are 0 best solutions below