GenHTTP
GenHTTP copied to clipboard
Add a framework to embrace MediatR
As a developer of a web application, I would like to simply re-use my MediatR handlers and forget about that complicated HTTP stuff, so that I can omit a lot of boilerplate code.
Example
public record GetUserQuery(int Id) : IRequest<User>;
var users = MediatRService.Create()
.Get<GetUserDetailsQuery>(":Id"); // automatically calls _mediator.Send(query)
var api = Layout.Create()
.Add("users", users)
.AddOpenApi();
Acceptance criteria
- The feature is implemented as new framework
- There is a new template project for this kind of projects
- The feature is documented on the GenHTTP website
- The feature is covered by acceptance tests
Is this using the existing MediatR or create a framework for that?
Existing MediatR - interesting part would be to find a clever mapping from queries to HTTP that works with the reflection module / the operation model.
So the idea is to have a REPR pattern option? Because it is already possible to use MediatR normally as in ASP.NET