diff --git a/LiMan.Serv/Controllers/WeatherForecastController.cs b/LiMan.Api/Controllers/WeatherForecastController.cs similarity index 100% rename from LiMan.Serv/Controllers/WeatherForecastController.cs rename to LiMan.Api/Controllers/WeatherForecastController.cs diff --git a/LiMan.Serv/LiMan.Serv.csproj b/LiMan.Api/LiMan.APi.csproj similarity index 65% rename from LiMan.Serv/LiMan.Serv.csproj rename to LiMan.Api/LiMan.APi.csproj index 17f70a4..5019fbf 100644 --- a/LiMan.Serv/LiMan.Serv.csproj +++ b/LiMan.Api/LiMan.APi.csproj @@ -4,6 +4,10 @@ net5.0 + + C:\Users\samuele\source\repos\LiManApp\LiMan.Api\LiMan.APi.xml + + diff --git a/LiMan.Api/LiMan.APi.xml b/LiMan.Api/LiMan.APi.xml new file mode 100644 index 0000000..610f17b --- /dev/null +++ b/LiMan.Api/LiMan.APi.xml @@ -0,0 +1,8 @@ + + + + LiMan.APi + + + + diff --git a/LiMan.Serv/Program.cs b/LiMan.Api/Program.cs similarity index 100% rename from LiMan.Serv/Program.cs rename to LiMan.Api/Program.cs diff --git a/LiMan.Serv/Properties/launchSettings.json b/LiMan.Api/Properties/launchSettings.json similarity index 100% rename from LiMan.Serv/Properties/launchSettings.json rename to LiMan.Api/Properties/launchSettings.json diff --git a/LiMan.Serv/Startup.cs b/LiMan.Api/Startup.cs similarity index 62% rename from LiMan.Serv/Startup.cs rename to LiMan.Api/Startup.cs index 68ea4be..6469d92 100644 --- a/LiMan.Serv/Startup.cs +++ b/LiMan.Api/Startup.cs @@ -9,30 +9,31 @@ using Microsoft.Extensions.Logging; using Microsoft.OpenApi.Models; using System; using System.Collections.Generic; +using System.IO; using System.Linq; +using System.Reflection; using System.Threading.Tasks; namespace LiMan.Serv { public class Startup { + #region Public Constructors + public Startup(IConfiguration configuration) { Configuration = configuration; } + #endregion Public Constructors + + #region Public Properties + public IConfiguration Configuration { get; } - // This method gets called by the runtime. Use this method to add services to the container. - public void ConfigureServices(IServiceCollection services) - { + #endregion Public Properties - services.AddControllers(); - services.AddSwaggerGen(c => - { - c.SwaggerDoc("v1", new OpenApiInfo { Title = "LiMan.Serv", Version = "v1" }); - }); - } + #region Public Methods // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) @@ -40,10 +41,19 @@ namespace LiMan.Serv if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); - app.UseSwagger(); - app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "LiMan.Serv v1")); + //app.UseSwagger(); + //app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "LiMan.Serv v1")); } + app.UseSwagger(c => + { + c.RouteTemplate = "/swagger/{documentName}/swagger.json"; + }); + app.UseSwaggerUI(c => + { + c.SwaggerEndpoint("v1/swagger.json", "GPW.Api"); + }); + app.UseHttpsRedirection(); app.UseRouting(); @@ -55,5 +65,20 @@ namespace LiMan.Serv endpoints.MapControllers(); }); } + + // This method gets called by the runtime. Use this method to add services to the container. + public void ConfigureServices(IServiceCollection services) + { + services.AddControllers(); + services.AddSwaggerGen(c => + { + c.SwaggerDoc("v1", new OpenApiInfo { Title = "LiMan.Api", Version = "v1" }); + // Set the comments path for the Swagger JSON and UI. + var xmlPath = Path.Combine(AppContext.BaseDirectory, $"{Assembly.GetExecutingAssembly().GetName().Name}.xml"); + c.IncludeXmlComments(xmlPath); + }); + } + + #endregion Public Methods } -} +} \ No newline at end of file diff --git a/LiMan.Serv/WeatherForecast.cs b/LiMan.Api/WeatherForecast.cs similarity index 100% rename from LiMan.Serv/WeatherForecast.cs rename to LiMan.Api/WeatherForecast.cs diff --git a/LiMan.Serv/appsettings.Development.json b/LiMan.Api/appsettings.Development.json similarity index 100% rename from LiMan.Serv/appsettings.Development.json rename to LiMan.Api/appsettings.Development.json diff --git a/LiMan.Serv/appsettings.json b/LiMan.Api/appsettings.json similarity index 100% rename from LiMan.Serv/appsettings.json rename to LiMan.Api/appsettings.json