From f3bcd0a85edaa1df8d1c1c8bc218f72cfc42b282 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Victor=20P=C3=A9rez=20Ngounou?= Date: Sat, 4 Feb 2023 15:08:36 +0100 Subject: [PATCH] Add Propertie --- .../Properties/launchSettings.json | 12 ++++++++++++ Sources/BowlingApi/BowlingApi.csproj | 1 + Sources/BowlingApi/Controllers/JoueurController.cs | 5 ++--- Sources/BowlingApi/Program.cs | 2 ++ 4 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 Sources/Bowling Api Gateway/Properties/launchSettings.json diff --git a/Sources/Bowling Api Gateway/Properties/launchSettings.json b/Sources/Bowling Api Gateway/Properties/launchSettings.json new file mode 100644 index 0000000..0db569b --- /dev/null +++ b/Sources/Bowling Api Gateway/Properties/launchSettings.json @@ -0,0 +1,12 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "profiles": { + "Bowling Api Gateway": { + "commandName": "Project", + "applicationUrl": "http://localhost:7003", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/Sources/BowlingApi/BowlingApi.csproj b/Sources/BowlingApi/BowlingApi.csproj index 87fe556..087a05a 100644 --- a/Sources/BowlingApi/BowlingApi.csproj +++ b/Sources/BowlingApi/BowlingApi.csproj @@ -16,6 +16,7 @@ + diff --git a/Sources/BowlingApi/Controllers/JoueurController.cs b/Sources/BowlingApi/Controllers/JoueurController.cs index 1af99b7..75f6c23 100644 --- a/Sources/BowlingApi/Controllers/JoueurController.cs +++ b/Sources/BowlingApi/Controllers/JoueurController.cs @@ -5,9 +5,9 @@ using Microsoft.AspNetCore.Mvc; namespace BowlingApi.Controllers; +[ApiVersion("1.0")] [ApiController] -[Route("api/[controller]")] - +[Route("api/v{version:apiVersion}/[controller]")] public class JoueurController:Controller { private IJoueurService _joueurService; @@ -55,7 +55,6 @@ public class JoueurController:Controller /// Retourne la liste des joueurs /// Si la liste est vide /// Si une erreur est survenue - [HttpGet("{page}/{pageSize}")] [ProducesResponseType(typeof(string), StatusCodes.Status500InternalServerError)] [ProducesResponseType(typeof(string), StatusCodes.Status404NotFound)] diff --git a/Sources/BowlingApi/Program.cs b/Sources/BowlingApi/Program.cs index caee074..5564b8e 100644 --- a/Sources/BowlingApi/Program.cs +++ b/Sources/BowlingApi/Program.cs @@ -17,6 +17,7 @@ builder.Services.AddEndpointsApiExplorer(); builder.Services.AddSwaggerGen(c=> { c.SwaggerDoc("v1", new() { Title = "APi Bowling APP", Version = "v1" }); + c.SwaggerDoc("v2", new() { Title = "APi Bowling APP", Version = "v2" }); c.IncludeXmlComments(Path.Combine(AppContext.BaseDirectory, "BowlingApi.xml")); }); builder.Services.AddAutoMapper(typeof(JoueurProfile)); @@ -52,6 +53,7 @@ if (app.Environment.IsDevelopment()) app.UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/v1/swagger.json", "API du projet Bowling APP v1"); + c.SwaggerEndpoint("/swagger/v2/swagger.json", "API du projet Bowling APP v2"); }); }