'Swagger-ui with node.js misses CSS, though otherwise rendering fine

I am trying to get swagger-ui npm work in my node.js application.

I have a js file with the following code:

  const swagger = require('swagger-ui');

  module.exports = Backbone.View.extend({
      initialize: function() {
        this.$el.html(pugFile);
        
        swagger({
          spec: {... specs},
          dom_id: '#docus',
        });
      }
    });

where specs contains json for the API definition. It loads and renders fine - but without any CSS!

There is no other code in my application for using swagger-ui, only those few lines. If the CSS wasn't missing, all would be perfect.

Can someone point out to me what I am missing? I just installed swagger-ui with "npm install swagger-ui" and used it as above.

Thanks a lot!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source