Refactor backend into domain-first slices
This commit is contained in:
23
apps/backend/Universe/Api/GetWorldHealthHandler.cs
Normal file
23
apps/backend/Universe/Api/GetWorldHealthHandler.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using FastEndpoints;
|
||||
|
||||
namespace SpaceGame.Api.Universe.Api;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user