-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStartup.cs
40 lines (32 loc) · 977 Bytes
/
Startup.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddControllersWithViews();
// Add CORS configuration
builder.Services.AddCors(options =>
{
options.AddPolicy("AllowAllOrigins",
builder => builder.WithOrigins(
"https://master.d12yk2hn6rz66e.amplifyapp.com",
"https://www.wfcantera.link/")
.AllowAnyMethod()
.AllowAnyHeader());
});
var app = builder.Build();
// Configure the HTTP request pipeline.
//if (!app.Environment.IsDevelopment())
//{
app.UseHsts();
//}
app.UseHttpsRedirection();
app.UseRouting();
app.UseStaticFiles();
#pragma warning disable ASP0014 // Suggest using top level route registrations
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
endpoints.MapControllerRoute(
name: "api",
pattern: "api/{controller}/{action}");
});
#pragma warning restore ASP0014 // Suggest using top level route registrations
app.Run();