-
Notifications
You must be signed in to change notification settings - Fork 16
Problem with path #10
Comments
I also have tried using express subpath: var subpath = express(); but getting the same result: operation1's route is still "/operation1"; changing it to "/v1/operaton1" makes UI to want to use "/v1/v1/operaton1"... |
Hi Mangvlad. Tomorrow I'll try to reproduce your problem.
Stay tuned ! |
Let's say I have security/getprofile and security/gettoken and data/resource1 and data/resource2 operations in 2 different APIs. I would like to expose it to the client like this:
and in the same time, Resource Listing file can be exposed at my company/api-docs... |
Hi Mangvlad. We fixed this issue in version 1.5.0 (release in progress). It will allow you to achieve your goal. On behalf of the team, I apologize for taking so long to handle this problem. Damien. |
I am trying to use new descPath option and it is not working correctly.
The problem appears to be with routes for operatons.
The code makes all routes to be exactly what "path" attribute is, without using the base path. The UI appends the path to the base path so no operation can be reached.
Also, if you try to get JSON definition, the UI will have something like: http://localhost:8002/api1/v1/api1/v1/api-docs/api1
(Ideally I would like to have several different APIs to be described in the same application and avoid hardcoding "http" and "localhost" as much as possible by using the relative path...)
Here is the sample (docs folder has swagger-ui):
var express = require("express"),
swagger = require("swagger-jack");
var app = express();
app.configure(function () {
);
var docs_handler = express.static(__dirname + '/docs');
app.get(/^/docs(/.*)?$/, function (req, res, next) {
if (req.url === '/docs') { // express static barfs on root url w/o trailing slash
res.writeHead(302, { 'Location': req.url + '/' });
res.end();
return;
}
// take off leading /docs so that connect locates file correctly
req.url = req.url.substr('/docs'.length);
console.log(req.url)
return docs_handler(req, res, next);
});
// start the server
app.listen(8002);
The text was updated successfully, but these errors were encountered: