Sources.cs 492 B

1234567891011121314151617181920
  1. using MediatR;
  2. using Web.Api.Common;
  3. namespace Web.Api.Endpoints.News;
  4. internal sealed class Sources : IEndpoint
  5. {
  6. public void MapEndpoint(IEndpointRouteBuilder app)
  7. {
  8. app.MapGet("api/news/sources", async (
  9. ISender sender,
  10. CancellationToken ct
  11. ) =>
  12. {
  13. return ApiResponse.Ok(await sender.Send(new Application.Features.Api.News.GetSources.Query(), ct));
  14. })
  15. .WithTags("News")
  16. .AllowAnonymous();
  17. }
  18. }