Feat: Routing andando

Signed-off-by: fede <federico.nicolas.polidoro@gmail.com>
This commit is contained in:
2024-10-15 03:30:01 -03:00
parent 8742c4a39e
commit 9487546fd6
29 changed files with 437 additions and 50 deletions

View File

@@ -1,30 +1,41 @@
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddControllers();
builder.Services.AddControllersWithViews();
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.Services.AddCors(options =>
{
options.AddPolicy("AllowSvelteApp",
builder =>
{
builder.WithOrigins("*")
.AllowAnyHeader()
.AllowAnyMethod();
});
});
var app = builder.Build();
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
if (app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Home/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
app.UseSwagger();
app.UseSwaggerUI();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();
app.MapControllerRoute(
name: "default",
pattern: "{controller=Login}/{action=Index}/{id?}");
app.UseCors("AllowSvelteApp");
app.UseEndpoints(endpoints =>
{
// Mapea los controladores a las rutas predeterminadas.