Creating of git for project ApiEfCoreLibrary
This commit is contained in:
27
ApiEfCoreLibrary/Program.cs
Normal file
27
ApiEfCoreLibrary/Program.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using ApiEfCoreLibrary;
|
||||
using FastEndpoints;
|
||||
using FastEndpoints.Swagger;
|
||||
using FastEndpoints.Security;
|
||||
|
||||
WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// On ajoute ici FastEndpoints, un framework REPR et Swagger aux services disponibles dans le projet
|
||||
builder.Services
|
||||
.AddAuthenticationJwtBearer(s => s.SigningKey = "The secret used to sign tokens")
|
||||
.AddAuthorization()
|
||||
.AddFastEndpoints()
|
||||
.SwaggerDocument();
|
||||
|
||||
// On ajoute ici la configuration de la base de données
|
||||
builder.Services.AddDbContext<LibraryDbContext>();
|
||||
|
||||
// On construit l'application en lui donnant vie
|
||||
WebApplication app = builder.Build();
|
||||
app.UseAuthentication()
|
||||
.UseAuthorization()
|
||||
.UseFastEndpoints()
|
||||
.UseSwaggerGen();
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
|
||||
app.Run();
|
||||
Reference in New Issue
Block a user