feat(backend): move endpoints to FastEndpoints handlers
This commit is contained in:
16
apps/backend/Handlers/GetWorldHandler.cs
Normal file
16
apps/backend/Handlers/GetWorldHandler.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using FastEndpoints;
|
||||
using SpaceGame.Simulation.Api.Simulation;
|
||||
|
||||
namespace SpaceGame.Simulation.Api.Handlers;
|
||||
|
||||
public sealed class GetWorldHandler(WorldService worldService) : EndpointWithoutRequest
|
||||
{
|
||||
public override void Configure()
|
||||
{
|
||||
Get("/api/world");
|
||||
AllowAnonymous();
|
||||
}
|
||||
|
||||
public override Task HandleAsync(CancellationToken cancellationToken) =>
|
||||
SendOkAsync(worldService.GetSnapshot(), cancellationToken);
|
||||
}
|
||||
Reference in New Issue
Block a user