40 lines
925 B
C#
40 lines
925 B
C#
using Microsoft.AspNetCore.HttpLogging;
|
|
using NeonSprawl.Server.Game.Interaction;
|
|
using NeonSprawl.Server.Game.PositionState;
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
builder.Services.AddPositionStateStore(builder.Configuration);
|
|
|
|
if (builder.Environment.IsDevelopment())
|
|
{
|
|
builder.Services.AddHttpLogging(o =>
|
|
{
|
|
o.LoggingFields = HttpLoggingFields.RequestMethod
|
|
| HttpLoggingFields.RequestPath
|
|
| HttpLoggingFields.ResponseStatusCode
|
|
| HttpLoggingFields.Duration;
|
|
});
|
|
}
|
|
|
|
var app = builder.Build();
|
|
|
|
if (app.Environment.IsDevelopment())
|
|
{
|
|
app.UseHttpLogging();
|
|
}
|
|
|
|
app.MapGet("/", () => Results.Text(
|
|
"Neon Sprawl game server — GET /health for JSON status.",
|
|
"text/plain"));
|
|
|
|
app.MapGet("/health", () => Results.Json(new
|
|
{
|
|
status = "ok",
|
|
service = "NeonSprawl.Server",
|
|
}));
|
|
|
|
app.MapPositionStateApi();
|
|
app.MapInteractionApi();
|
|
|
|
app.Run();
|