diff --git a/API_SQLuedo/API/API.csproj b/API_SQLuedo/API/API.csproj index f3c90dd..822644c 100644 --- a/API_SQLuedo/API/API.csproj +++ b/API_SQLuedo/API/API.csproj @@ -9,6 +9,7 @@ + all diff --git a/API_SQLuedo/API/Controllers/UserController.cs b/API_SQLuedo/API/Controllers/UserController.cs index 8518f62..6d2e9d6 100644 --- a/API_SQLuedo/API/Controllers/UserController.cs +++ b/API_SQLuedo/API/Controllers/UserController.cs @@ -8,8 +8,9 @@ using Services; namespace API.Controllers { - [Route("api/[controller]")] + [Route("api/{version:apiVersion}/[controller]")] [Authorize] + [ApiVersion("1.0")] [ApiController] public class UserController : Controller { diff --git a/API_SQLuedo/API/Program.cs b/API_SQLuedo/API/Program.cs index d4dbe01..63d3d14 100644 --- a/API_SQLuedo/API/Program.cs +++ b/API_SQLuedo/API/Program.cs @@ -1,6 +1,7 @@ using API; using DbContextLib; using Microsoft.AspNetCore.Identity; +using Microsoft.AspNetCore.Mvc.Versioning; using Microsoft.EntityFrameworkCore; using Microsoft.OpenApi.Models; using Services; @@ -18,6 +19,7 @@ builder.Services.AddDbContext(); builder.Services.AddDbContext(options => options.UseInMemoryDatabase("appDb")); builder.Services.AddIdentityApiEndpoints().AddEntityFrameworkStores(); builder.Services.AddAuthorization(); +builder.Services.AddApiVersioning(o => o.ApiVersionReader = new HeaderApiVersionReader("api-version")); //builder.Services.AddIdentityApiEndpoints() // .AddEntityFrameworkStores(); builder.Services.AddSwaggerGen(option =>