restructure

This commit is contained in:
2023-03-21 09:41:48 +01:00
parent b7483d56a9
commit 1e4b69f83a
15 changed files with 3 additions and 3 deletions

39
Program.cs Normal file
View File

@@ -0,0 +1,39 @@
using MauMau_Server.Websockets;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
var services = builder.Services;
services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
services.AddEndpointsApiExplorer();
services.AddSwaggerGen();
services.AddScoped<IRoomManager, RoomManager>();
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}
var webSocketOptions = new WebSocketOptions()
{
KeepAliveInterval = TimeSpan.FromSeconds(120),
};
app.UseWebSockets(webSocketOptions);
app.UseCors(policyBuilder =>
{
policyBuilder.AllowAnyOrigin();
policyBuilder.AllowAnyMethod();
policyBuilder.AllowAnyHeader();
});
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.Run();