Feat: Migrado de datos de MariaDB a SQL Server y Fix de Tabla
This commit is contained in:
@@ -6,6 +6,25 @@ var builder = WebApplication.CreateBuilder(args);
|
||||
builder.Services.AddControllers();
|
||||
builder.Services.AddEndpointsApiExplorer();
|
||||
builder.Services.AddSwaggerGen();
|
||||
|
||||
// --- 1. DEFINIR LA POLÍTICA CORS ---
|
||||
// Definimos un nombre para nuestra política
|
||||
var MyAllowSpecificOrigins = "_myAllowSpecificOrigins";
|
||||
|
||||
// Añadimos el servicio de CORS y configuramos la política
|
||||
builder.Services.AddCors(options =>
|
||||
{
|
||||
options.AddPolicy(name: MyAllowSpecificOrigins,
|
||||
policy =>
|
||||
{
|
||||
// Permitimos explícitamente el origen de tu frontend (Vite)
|
||||
policy.WithOrigins("http://localhost:5173")
|
||||
.AllowAnyHeader() // Permitir cualquier encabezado
|
||||
.AllowAnyMethod(); // Permitir GET, POST, PUT, DELETE, etc.
|
||||
});
|
||||
});
|
||||
// -----------------------------------
|
||||
|
||||
builder.Services.AddSingleton<DapperContext>();
|
||||
|
||||
var app = builder.Build();
|
||||
@@ -22,5 +41,12 @@ if (app.Environment.IsDevelopment())
|
||||
}
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
|
||||
// --- 2. ACTIVAR EL MIDDLEWARE DE CORS ---
|
||||
// ¡IMPORTANTE! Debe ir ANTES de MapControllers y DESPUÉS de UseHttpsRedirection (si se usa)
|
||||
app.UseCors(MyAllowSpecificOrigins);
|
||||
// ----------------------------------------
|
||||
|
||||
app.MapControllers();
|
||||
|
||||
app.Run();
|
||||
@@ -13,7 +13,7 @@ using System.Reflection;
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("Inventario.API")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+80210e5d4c8c41b94acb737e8a8d9935a2ef21b6")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+85bd1915e09fdb3a2af7e28d58b8ba794a9e6360")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("Inventario.API")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("Inventario.API")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
Reference in New Issue
Block a user