Major update
This commit is contained in:
39
communication-hub/Program.cs
Normal file
39
communication-hub/Program.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using CommunicationHub.Hubs;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// Add services to the container.
|
||||
|
||||
builder.Services.AddControllers();
|
||||
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
||||
builder.Services.AddEndpointsApiExplorer();
|
||||
builder.Services.AddSignalR();
|
||||
builder.Services.AddCors((options) =>
|
||||
{
|
||||
options.AddPolicy("CorsPolicy", policy =>
|
||||
{
|
||||
policy.AllowAnyHeader()
|
||||
.AllowAnyMethod()
|
||||
.WithOrigins("http://localhost:3000")
|
||||
.AllowCredentials();
|
||||
});
|
||||
});
|
||||
builder.Services.AddSwaggerGen();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
if (app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseSwagger();
|
||||
app.UseSwaggerUI();
|
||||
}
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
app.UseRouting();
|
||||
app.UseCors("CorsPolicy");
|
||||
app.MapControllers();
|
||||
app.MapHub<SeasonHub>("/hubs/season");
|
||||
|
||||
app.Run();
|
||||
|
||||
Reference in New Issue
Block a user