b967bd70eb
- Introduced `IGameRepository` interface and its implementation. - Transitioned namespaces to `file-scoped` for consistency. - Simplified class definitions, e.g., `Game` and `SixDigitInt`. - Restructured `GameField` logic for improved readability and functionality. - Fixed formatting issues in `API.csproj` and added a `using` directive in `Program.cs`.
36 lines
703 B
C#
36 lines
703 B
C#
using API.Controllers;
|
|
using API.Services.GameManager;
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
// Add services to the container.
|
|
|
|
builder.Services.AddControllers();
|
|
builder.Services.AddSignalR();
|
|
builder.Services.AddOpenApi();
|
|
builder.Services.AddSwaggerGen();
|
|
|
|
builder.Services.AddSingleton<IGameManager, GameManager>();
|
|
|
|
var app = builder.Build();
|
|
|
|
// Configure the HTTP request pipeline.
|
|
if (app.Environment.IsDevelopment())
|
|
{
|
|
app.MapOpenApi();
|
|
app.UseSwagger();
|
|
app.UseSwaggerUI();
|
|
}
|
|
|
|
app.UseHttpsRedirection();
|
|
|
|
app.UseStaticFiles();
|
|
|
|
app.UseAuthorization();
|
|
|
|
app.MapControllers();
|
|
app.MapHub<GameHubSocket>("/api/gamehub");
|
|
|
|
app.MapFallbackToFile("index.html");
|
|
|
|
app.Run(); |