Beispiel #1
0
 public void ConfigureEndpoints(IEndpointRouteBuilder endpoints)
 {
     endpoints.MapGet(Path, ctx => ctx.Response.WriteAsync($"{Name} module"));
     endpoints
     .Get <BrowseStories, Paged <StoryDto> >($"{Path}/stories")
     .Get <GetStory, StoryDetailsDto>($"{Path}/stories/{{storyId}}")
     .Post <SendStory>($"{Path}/stories", after: (cmd, ctx) =>
     {
         var storage = ctx.RequestServices.GetRequiredService <IStoryRequestStorage>();
         var storyId = storage.GetStoryId(cmd.Id);
         return(ctx.Response.Created($"{Path}/stories/{storyId}"));
     })
     .Post <RateStory>($"{Path}/stories/{{storyId}}/rate");
 }