misc swagger tweaks

ref #131
This commit is contained in:
Collin M. Barrett 2018-06-07 15:12:02 -05:00
parent 0ddb7e0537
commit 38b907c827
2 changed files with 6 additions and 3 deletions

View file

@ -60,13 +60,16 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env)
app.UseMvc();
app.UseSwagger(c =>
{
c.PreSerializeFilters.Add((swaggerDoc, httpReq) => swaggerDoc.Host = httpReq.Host.Value);
#if RELEASE
c.PreSerializeFilters.Add((swaggerDoc, httpReq) => swaggerDoc.BasePath = "/api");
c.RouteTemplate = "docs/{documentName}/swagger.json";
#endif
c.RouteTemplate = "/docs/{documentName}/swagger.json";
UseLowercaseControllerNameInSwaggerHack(c);
});
app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("v1/swagger.json", "FilterLists API v1");
c.SwaggerEndpoint("/docs/v1/swagger.json", "FilterLists API v1");
c.DocumentTitle = "FilterLists API v1";
c.RoutePrefix = "docs";
});

View file

@ -21,7 +21,7 @@ export class Layout extends React.Component<ILayoutProps, {}> {
</div>
<div className="row justify-content-center">
<p className="mt-2 ml-1 mr-1">
<a href="https://filterlists.com/api/docs/">API</a> | <a href="https://github.com/collinbarrett/FilterLists">GitHub</a> | By <a href="https://collinmbarrett.com/">Collin M. Barrett</a>
<a href="https://filterlists.com/api/docs/index.html">API</a> | <a href="https://github.com/collinbarrett/FilterLists">GitHub</a> | By <a href="https://collinmbarrett.com/">Collin M. Barrett</a>
</p>
</div>
</div>;