forked from sanchezvem/PyroFetes
43 lines
1.0 KiB
C#
43 lines
1.0 KiB
C#
using FastEndpoints;
|
|
using FastEndpoints.Swagger;
|
|
using PyroFetes;
|
|
|
|
WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
|
|
|
|
//builder.Services
|
|
// .AddAuthenticationJwtBearer(s => s.SigningKey = "Thesecretusedtosigntokens")
|
|
// .AddAuthentication();
|
|
|
|
builder.Services.AddCors(options =>
|
|
options.AddDefaultPolicy(policyBuilder =>
|
|
policyBuilder.WithOrigins("http://localhost:61021")
|
|
.WithMethods("GET", "POST", "PUT", "PATCH", "DELETE")
|
|
.AllowAnyHeader()
|
|
)
|
|
);
|
|
//builder.Services.AddAuthorization();
|
|
|
|
|
|
builder.Services.AddFastEndpoints().SwaggerDocument(
|
|
options =>
|
|
{
|
|
options.ShortSchemaNames = true;
|
|
});
|
|
|
|
builder.Services.AddDbContext<PyroFetesDbContext>();
|
|
|
|
WebApplication app = builder.Build();
|
|
// app.UseAuthorization()
|
|
// .UseAuthentication();
|
|
app.UseFastEndpoints(options =>
|
|
{
|
|
options.Endpoints.RoutePrefix = "API";
|
|
options.Endpoints.ShortNames = true;
|
|
}
|
|
).UseSwaggerGen();
|
|
|
|
app.UseHttpsRedirection();
|
|
|
|
app.UseCors();
|
|
|
|
app.Run(); |