17 lines
409 B
C#
17 lines
409 B
C#
using FastEndpoints;
|
|
using SpaceGame.Api.Simulation;
|
|
|
|
namespace SpaceGame.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);
|
|
}
|