1
This commit is contained in:
19
Yes.Blog/Endpoints/Blogs/RssEndpoint.cs
Normal file
19
Yes.Blog/Endpoints/Blogs/RssEndpoint.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
|
||||
namespace Yes.Blog.Endpoints.Blogs
|
||||
{
|
||||
public class RssEndpoint : BlogEndpointScheme, IEndpoint
|
||||
{
|
||||
public void Map(IEndpointRouteBuilder app) => app.MapGet("feed", Handle).AllowAnonymous();
|
||||
|
||||
private async Task<Microsoft.AspNetCore.Http.IResult> Handle(
|
||||
IMediator mediator,
|
||||
IMapper mapper,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
var response = await mediator.Send(new GetRssQuery(), cancellationToken);
|
||||
|
||||
return Results.Text(response.Xml, "application/rss+xml; charset=utf-8");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user