krakenjs / swaggerize-express

Design-driven apis with swagger 2.0 and express.
Other
354 stars 81 forks source link

Adding setBasePath method on app, allowing to change basePath at runtime #56

Closed bg-o closed 9 years ago

bg-o commented 9 years ago

Since host cannot include subpaths, as defined in official swagger specs, this is necessary if your web apps are behind the same url. Example: http://my.platform.com/mywebapp/. In that case basePath used for generation is empty and basePath used externally is mywebapp.

Extract from official spec:

The host (name or ip) serving the API. This MUST be the host only and does not include the scheme nor sub-paths. It MAY include a port. If the host is not included, the host serving the documentation is to be used (including the port). The host does not support path templating.

tlivings commented 9 years ago

This is actually going to be a lot easier to do in 4.0.0 because the entire api document is exposed under app.swagger.

I am going to go ahead and close this since it will no longer be necessary after the merge of https://github.com/krakenjs/swaggerize-express/pull/60.