Skip to content

Instantly share code, notes, and snippets.

@subhendu-de
Created December 9, 2018 14:09
Show Gist options
  • Save subhendu-de/11e4d3dba7bd0e30dc411b6ae2748481 to your computer and use it in GitHub Desktop.
Save subhendu-de/11e4d3dba7bd0e30dc411b6ae2748481 to your computer and use it in GitHub Desktop.
using Swashbuckle.AspNetCore.Swagger;
namespace eKart.Api
{
public class Startup
{
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
// Register the Swagger generator, defining 1 or more Swagger documents
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new Info { Title = "eKart API", Version = "v1" });
});
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
// Enable middleware to serve generated Swagger as a JSON endpoint.
app.UseSwagger();
// Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.),
// specifying the Swagger JSON endpoint.
app.UseSwaggerUI(c =>;
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "eKart V1");
});
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment