Skip to content

Latest commit

 

History

History
26 lines (22 loc) · 717 Bytes

File metadata and controls

26 lines (22 loc) · 717 Bytes

FluentUtils.MinimalApis.EndpointDefinitions

Example Usage

public class WeatherForecastEndpointDefinition : IEndpointDefinition
{
    public void DefineEndpoints(WebApplication app)
    {
        app.MapGet(
            "/weatherforecast",
            (IWeatherForecastService weatherForecastService) =>
            {
                IEnumerable<WeatherForecast> result = weatherForecastService.GetAll();
                return Results.Ok(result);
            }
        ).Produces<IEnumerable<WeatherForecast>>();
    }

    public void DefineServices(IServiceCollection services)
    {
        services.AddScoped<IWeatherForecastService, WeatherForecastService>();
    }
}