feat: Implement BolsaLocalWidget and configure API CORS
This commit is contained in:
		| @@ -7,6 +7,21 @@ using System.Reflection; | ||||
|  | ||||
| var builder = WebApplication.CreateBuilder(args); | ||||
|  | ||||
| // Nombre para política de CORS | ||||
| var MyAllowSpecificOrigins = "_myAllowSpecificOrigins"; | ||||
|  | ||||
| // Añadimos el servicio de CORS | ||||
| builder.Services.AddCors(options => | ||||
| { | ||||
|     options.AddPolicy(name: MyAllowSpecificOrigins, | ||||
|                       policy => | ||||
|                       { | ||||
|                           policy.WithOrigins("http://localhost:5173")  | ||||
|                                 .AllowAnyHeader() | ||||
|                                 .AllowAnyMethod(); | ||||
|                       }); | ||||
| }); | ||||
|  | ||||
| // 1. Registramos nuestra fábrica de conexiones a la BD. | ||||
| builder.Services.AddSingleton<IDbConnectionFactory, SqlConnectionFactory>(); | ||||
|  | ||||
| @@ -56,6 +71,8 @@ if (app.Environment.IsDevelopment()) | ||||
|  | ||||
| app.UseHttpsRedirection(); | ||||
|  | ||||
| app.UseCors(MyAllowSpecificOrigins); | ||||
|  | ||||
| app.UseAuthorization(); | ||||
|  | ||||
| app.MapControllers(); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user