Skip to content

Instantly share code, notes, and snippets.

@kpietraszko
Created June 30, 2023 09:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kpietraszko/68792419a62bf2bdb90d58a232268e29 to your computer and use it in GitHub Desktop.
Save kpietraszko/68792419a62bf2bdb90d58a232268e29 to your computer and use it in GitHub Desktop.
public class SomeApiGroup : IEndpointsGroup<SomeApiGroup.Dependencies>
{
public record Dependencies(
ILogger Logger,
ProductsApplicationService service);
internal static RouteGroupBuilder MapEndpoints(this WebApplication app)
{
var group = app.MapGroup("/products");
group.MapGet("/{publicId}", (Guid publicId, SomeApiGroup.Dependencies dependencies) =>
{
return Ok(new TestResponse(dependencies.service.Something()));
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment