Answers for "blazor swagger setup"

C#
0

blazor swagger setup

//Install-Package Swashbuckle.AspNetCore
//using 

public class Startup
{
    public Startup(IConfiguration configuration)
    {
        Configuration = configuration;
    }

    public IConfiguration Configuration { get; }

    public void ConfigureServices(IServiceCollection services)
    {
        services.AddSwaggerGen();
    }

    public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
    {
        app.UseSwagger();
        app.UseSwaggerUI(c =>
        {
            c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
        });
    }
}
Posted by: Guest on July-12-2020

C# Answers by Framework

Browse Popular Code Answers by Language