feat(backend): move endpoints to FastEndpoints handlers

This commit is contained in:
2026-03-19 15:23:58 -04:00
parent 3ca568c05d
commit 792fc5619b
7 changed files with 136 additions and 53 deletions

View File

@@ -0,0 +1,24 @@
using FastEndpoints;
using SpaceGame.Simulation.Api.Simulation;
namespace SpaceGame.Simulation.Api.Handlers;
public sealed class GetWorldHealthHandler(WorldService worldService) : EndpointWithoutRequest
{
public override void Configure()
{
Get("/api/world/health");
AllowAnonymous();
}
public override Task HandleAsync(CancellationToken cancellationToken)
{
var status = worldService.GetStatus();
return SendOkAsync(new
{
ok = true,
sequence = status.Sequence,
generatedAtUtc = status.GeneratedAtUtc,
}, cancellationToken);
}
}