diff --git a/AspNetCoreLearnOfficial.sln b/AspNetCoreLearnOfficial.sln index 05f29d1..e08c6e4 100644 --- a/AspNetCoreLearnOfficial.sln +++ b/AspNetCoreLearnOfficial.sln @@ -5,6 +5,8 @@ VisualStudioVersion = 17.5.002.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WebApi", "WebApi\WebApi.csproj", "{9FAB855B-340B-4F20-9C96-091F36B18706}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PizzaStore", "MinimumWebAPI\PizzaStore.csproj", "{01E3A866-5135-403E-9059-42EAC85586BC}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -15,6 +17,10 @@ Global {9FAB855B-340B-4F20-9C96-091F36B18706}.Debug|Any CPU.Build.0 = Debug|Any CPU {9FAB855B-340B-4F20-9C96-091F36B18706}.Release|Any CPU.ActiveCfg = Release|Any CPU {9FAB855B-340B-4F20-9C96-091F36B18706}.Release|Any CPU.Build.0 = Release|Any CPU + {01E3A866-5135-403E-9059-42EAC85586BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {01E3A866-5135-403E-9059-42EAC85586BC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {01E3A866-5135-403E-9059-42EAC85586BC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {01E3A866-5135-403E-9059-42EAC85586BC}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/MinimumWebAPI/PizzaStore.csproj b/MinimumWebAPI/PizzaStore.csproj index 1b28a01..5419ef0 100644 --- a/MinimumWebAPI/PizzaStore.csproj +++ b/MinimumWebAPI/PizzaStore.csproj @@ -6,4 +6,8 @@ enable + + + + diff --git a/MinimumWebAPI/Program.cs b/MinimumWebAPI/Program.cs index c368122..3196f15 100644 --- a/MinimumWebAPI/Program.cs +++ b/MinimumWebAPI/Program.cs @@ -1,8 +1,24 @@ using Microsoft.OpenApi.Models; var builder = WebApplication.CreateBuilder(args); + +builder.Services.AddEndpointsApiExplorer(); +builder.Services.AddSwaggerGen(c => +{ + c.SwaggerDoc("v1", new OpenApiInfo { Title = "PizzaStore API", Description = "Making the Pizzas you love", Version = "v1" }); +}); + var app = builder.Build(); +if (app.Environment.IsDevelopment()) +{ + app.UseSwagger(); + app.UseSwaggerUI(c => + { + c.SwaggerEndpoint("/swagger/v1/swagger.json", "PizzaStore API V1"); + }); +} + app.MapGet("/", () => "Hello World!"); app.Run();