🚧 replacing api in frontend
Co-authored-by: haraldnilsen <harald_998@hotmail.com>
This commit is contained in:
parent
0d363acdcb
commit
f591abe341
4 changed files with 24 additions and 10 deletions
|
@ -11,6 +11,18 @@ var builder = WebApplication.CreateBuilder(args);
|
|||
// Add services to the container.
|
||||
|
||||
builder.Services.AddControllers();
|
||||
|
||||
var MyAllowSpecificOrigins = "_myAllowSpecificOrigins";
|
||||
|
||||
builder.Services.AddCors(options =>
|
||||
{
|
||||
options.AddPolicy(name: MyAllowSpecificOrigins,
|
||||
policy =>
|
||||
{
|
||||
policy.WithOrigins("http://localhost:5173");
|
||||
});
|
||||
});
|
||||
|
||||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
||||
builder.Services.AddEndpointsApiExplorer();
|
||||
builder.Services.AddSwaggerGen();
|
||||
|
@ -50,6 +62,8 @@ if (app.Environment.IsDevelopment())
|
|||
|
||||
app.UseHttpsRedirection();
|
||||
|
||||
app.UseCors(MyAllowSpecificOrigins);
|
||||
|
||||
app.UseAuthorization();
|
||||
|
||||
app.MapControllers();
|
||||
|
|
Reference in a new issue