added basePath

This commit is contained in:
Tony Tam 2014-11-19 13:36:59 -08:00
parent d12a565032
commit 9ffece910d
2 changed files with 13 additions and 3 deletions

View File

@ -31,7 +31,7 @@
<version>${jetty-version}</version> <version>${jetty-version}</version>
<configuration> <configuration>
<webAppConfig> <webAppConfig>
<contextPath>/</contextPath> <contextPath>{{^basePath}}/{{/basePath}}{{#basePath}}{{basePath}}{{/basePath}}</contextPath>
</webAppConfig> </webAppConfig>
<webAppSourceDirectory>target/${project.artifactId}-${project.version}</webAppSourceDirectory> <webAppSourceDirectory>target/${project.artifactId}-${project.version}</webAppSourceDirectory>
<webDefaultXml>${project.basedir}/conf/jetty/webdefault.xml</webDefaultXml> <webDefaultXml>${project.basedir}/conf/jetty/webdefault.xml</webDefaultXml>

View File

@ -20,7 +20,17 @@ var corsOptions = {
app.use(cors(corsOptions)); app.use(cors(corsOptions));
{{#basePath}}
var subpath = express();
app.use("{{{basePath}}}", subpath);
swagger.setAppHandler(subpath);
{{/basePath}}
{{^basePath}}
swagger.setAppHandler(app); swagger.setAppHandler(app);
{{/basePath}}
swagger.configureSwaggerPaths("", "api-docs", "") swagger.configureSwaggerPaths("", "api-docs", "")
var models = require("./app/models.js"); var models = require("./app/models.js");
@ -36,7 +46,7 @@ swagger.addModels(models)
{{/apis}}{{/apiInfo}}; {{/apis}}{{/apiInfo}};
// configures the app // configures the app
swagger.configure("http://localhost:8002", "0.1"); swagger.configure("http://localhost:8002{{basePath}}", "0.1");
// start the server // start the server
app.listen(8002); app.listen(8002);