Nocpad.AspNetCore.MinimalEndpoints 2.0.1

dotnet add package Nocpad.AspNetCore.MinimalEndpoints --version 2.0.1
NuGet\Install-Package Nocpad.AspNetCore.MinimalEndpoints -Version 2.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Nocpad.AspNetCore.MinimalEndpoints" Version="2.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Nocpad.AspNetCore.MinimalEndpoints --version 2.0.1
#r "nuget: Nocpad.AspNetCore.MinimalEndpoints, 2.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Nocpad.AspNetCore.MinimalEndpoints as a Cake Addin
#addin nuget:?package=Nocpad.AspNetCore.MinimalEndpoints&version=2.0.1

// Install Nocpad.AspNetCore.MinimalEndpoints as a Cake Tool
#tool nuget:?package=Nocpad.AspNetCore.MinimalEndpoints&version=2.0.1

About

A source generator that can be used to automatically generate the boilerplate code required to map endpoints.

Examples

Program.cs

app.MapMinimalEndpoints();

Endpoint associated with a group

using Nocpad.AspNetCore.MinimalEndpoints; // you may add a global using statement

internal sealed class WeatherEndpointGroup : IEndpointGroupConfiguration
{
    public static string Route => "api/weather";

    public static string Name => "Weather";

    public static void Configure(RouteGroupBuilder group) => group.RequireAuthorization();
}


[Endpoint<WeatherEndpointGroup>]
internal sealed class GetWeather : IEndpoint
{
    [Get("forecast")]
    // [Validate<Request>, Get("forecast")] 
    // [Validate<Request>, Get("forecast", Policies = ["policy name"])
    // [Validate<Request>, Get("forecast", Policies = ["policy name", "second policy"], RequireAuthorization = true/false)]
    internal static WeatherForecast[] Get(Request request)
    {
       // implementation...
    }
}

Simple endpoint without a group/configuration

[Endpoint]
internal sealed class Upload
{
    [Post("/file-upload")]
    public static IResult Handle(IFormFile file) => Results.Ok(new { file.FileName, file.ContentType, file.Length });
}
[Endpoint]
internal sealed class Upload : IEndpointConfiguration
{
    public static void Configure(RouteHandlerBuilder builder)
    {
        // endpoint configuration
    }

    [Post("/file-upload")]
    public static IResult Handle(IFormFile file) => Results.Ok(new { file.FileName, file.ContentType, file.Length });
}
There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

  • .NETStandard 2.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.1 255 4/13/2024
2.0.0 191 4/12/2024