Problem
How to add documentation and help pages for ASP.NET Core Web API.
Solution
Add NuGet package - Swashbuckle.AspNetCore
Update the Startup class to add services and middleware for Swagger.
- public void ConfigureServices(
- IServiceCollection services)
- {
- services.AddSwaggerGen(options =>
- {
- options.SwaggerDoc("help", new Info
- {
- Title = "Fiver.Api Help",
- Version = "v1"
- });
- });
- // other services
- }
- public void Configure(
- IApplicationBuilder app,
- IHostingEnvironment env)
- {
- app.UseSwagger();
- app.UseSwaggerUI(options =>
- {
- options.SwaggerEndpoint(
- "/swagger/help/swagger.json", "Fiver.Api Help Endpoint");
- });
- // other middleware
- }
The help page can be accessed via: [host]/swagger

Discussion
Swagger is a format to describe RESTful APIs and Swashbuckle generates these swagger documents.
Join the conversation! Your thoughts help the community grow.