mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-02 09:01:10 +00:00
Replaces MVC with FastEndpoints in Lumina.Presentation.Api
This commit is contained in:
1 parent
b1a20716df
commit
c7b8bc2f1c
519 files changed
+15329
-8539
No files matched your search
@@ -1,11 +1,12 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using FastEndpoints;
|
||||
using FastEndpoints.Swagger;
|
||||
using Lumina.Application.Common.DependencyInjection;
|
||||
using Lumina.DataAccess.Common.DependencyInjection;
|
||||
using Lumina.Domain.Common.DependencyInjection;
|
||||
using Lumina.Infrastructure.Common.DependencyInjection;
|
||||
using Lumina.Presentation.Api.Common.DependencyInjection;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
|
||||
@@ -37,18 +38,21 @@ public class Program
|
||||
|
||||
app.UseCors("AllowAll");
|
||||
|
||||
app.UseExceptionHandler("/error"); // uses a middleware which reexecutes the request to the error path
|
||||
|
||||
// configure the HTTP request pipeline.
|
||||
if (app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI();
|
||||
}
|
||||
//app.UseExceptionHandler("/error"); // uses a middleware which re-executes the request to the error path
|
||||
|
||||
//app.UseHttpsRedirection();
|
||||
|
||||
app.MapControllers();
|
||||
app.UseAuthorization();
|
||||
|
||||
app.UseFastEndpoints(config =>
|
||||
{
|
||||
config.Endpoints.RoutePrefix = "api";
|
||||
config.Versioning.Prefix = "v";
|
||||
config.Versioning.DefaultVersion = 1;
|
||||
config.Versioning.PrependToRoute = true;
|
||||
config.Endpoints.ShortNames = true;
|
||||
});
|
||||
app.UseSwaggerGen();
|
||||
|
||||
await app.RunAsync().ConfigureAwait(false);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user