CourseWorkElectronicsShop/ElectronicsShop/ElectronicsShopResrAPI/Program.cs

28 lines
737 B
C#
Raw Normal View History

2024-04-29 21:57:01 +04:00
using Microsoft.OpenApi.Models;
2024-04-29 21:38:18 +04:00
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
2024-04-29 21:57:01 +04:00
builder.Services.AddSwaggerGen(x => x.SwaggerDoc("v1", new OpenApiInfo { Title = "ElectronicsShopResrAPI", Version = "v1" }));
2024-04-29 21:38:18 +04:00
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
2024-04-29 21:57:01 +04:00
app.UseSwaggerUI(x => x.SwaggerEndpoint("/swagger/v1/swagger.json", "ElectronicsShopResrAPI v1"));
2024-04-29 21:38:18 +04:00
}
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.Run();