tobinbradley/dirt-simple-postgis-http-api

SwaggerUIBundle is not defined

Closed this issue · 4 comments

I've just upgraded to the newer version and hit a snag.

Getting a empty screen and this error in my console:

api:40 Uncaught ReferenceError: SwaggerUIBundle is not defined at window.onload (api:40)

See for yourself: http://all-mapped-out.co.uk/api

I'm running a proxy on my apache server using these parameters (from an older version):

ProxyPass /api http://localhost:3000
ProxyPass /swaggerui http://localhost:3000/swaggerui

And these options in my config:

"swagger": {
    "basePath": "/api",
    "externalDocs": {
      "url": "https://github.com/tobinbradley/dirt-simple-postgis-http-api",
      "description": "Source code on Github"
    }

Might be really something simple I'm missing but I'm totally stumped!

Best guess is you're running into the same trailing slash issue you had with nginx. Apache treats trailing slashes in much the same way as nginx, though I think with apache both arguments require a trailing slash.

Also, you shouldn't need a separate proxy for swaggerui anymore.

Wow, who knew! So it's just a case of explicitly using http://all-mapped-out.co.uk/api/

I guess a redirect rule could be added to stop this happening.

+1 for just one proxy too!

Glad it works!

Swagger docs are static in the documentation folder now (swagger config still auto-generated), and are treated like a regular route (documentation.js in the routes folder). That eliminates proxy issues and lets you customize your doc page however you want.

Best guess is you're running into the same trailing slash issue you had with nginx. Apache treats trailing slashes in much the same way as nginx, though I think with apache both arguments require a trailing slash.

Also, you shouldn't need a separate proxy for swaggerui anymore.

Heeyy Thank you, this helped to solve my problem.