From 210d299f0eef4ba82d741f354b7db3f7ec811ae1 Mon Sep 17 00:00:00 2001 From: cuqmbr Date: Sat, 16 Jul 2022 11:05:10 +0300 Subject: [PATCH] feat: add Swagger --- Server/Program.cs | 4 +++- Server/Properties/launchSettings.json | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Server/Program.cs b/Server/Program.cs index 81a472e..9a50f15 100644 --- a/Server/Program.cs +++ b/Server/Program.cs @@ -7,6 +7,7 @@ var builder = WebApplication.CreateBuilder(args); builder.Services.AddControllers(); builder.Services.AddEndpointsApiExplorer(); +builder.Services.AddSwaggerGen(); builder.Services.AddDbContext(o => o.UseSqlite(builder.Configuration.GetConnectionString("DefaultConnection"))); @@ -15,7 +16,8 @@ var app = builder.Build(); // Configure the HTTP request pipeline. if (app.Environment.IsDevelopment()) { - + app.UseSwagger(); + app.UseSwaggerUI(); } app.UseHttpsRedirection(); diff --git a/Server/Properties/launchSettings.json b/Server/Properties/launchSettings.json index da63d20..f21c3a1 100644 --- a/Server/Properties/launchSettings.json +++ b/Server/Properties/launchSettings.json @@ -13,7 +13,7 @@ "commandName": "Project", "dotnetRunMessages": true, "launchBrowser": true, - "launchUrl": "", + "launchUrl": "swagger", "applicationUrl": "https://localhost:7248;http://localhost:5214", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" @@ -22,7 +22,7 @@ "IIS Express": { "commandName": "IISExpress", "launchBrowser": true, - "launchUrl": "", + "launchUrl": "swagger", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" }