QuickEndpoints 1.0.0

dotnet add package QuickEndpoints --version 1.0.0
                    
NuGet\Install-Package QuickEndpoints -Version 1.0.0
                    
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="QuickEndpoints" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="QuickEndpoints" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="QuickEndpoints" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add QuickEndpoints --version 1.0.0
                    
#r "nuget: QuickEndpoints, 1.0.0"
                    
#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.
#:package QuickEndpoints@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=QuickEndpoints&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=QuickEndpoints&version=1.0.0
                    
Install as a Cake Tool

QuickEndpoints nuget

Table of contents

About

  • Quick summary

    If you want to switch from havy controllers to minimal .net8 API this is fastest and simpliest solution. In core this is minimal API generator.

  • Targeted framework

    .net8

  • Version

    1.0.0

Installation

Add 'QuickEndpoints' nuget to project

Usage

Implementation

Implementation is very simple, just remove all references to .net controllers from project, than in controllers:

  • replace ': ControllerBase' with ': IQuickEndpoint'
  • replace [Route("api/v{v:apiVersion}/[controller]")] with [Route("api/v{v:apiVersion}/[endpoint]")].
  • replace 'Controller' in class name with 'QEndpointGroup' or 'QuickEndpointsGroup' or 'QEndpoint' or 'QuickEndpoints' or 'Endpoint' or 'Endpoints' If api explorer (swagger) is used configuration remains the same as for controllers. If you start metods with http word, like Get and there is no [HttpGet] attribute than method is assumed HTTP GET.

All controller attributes remains functional, this is the list:

  • [Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)]
  • [ApiVersion("1.0")]
  • [Route()]
  • [Produces("application/json")]
  • [ProducesResponseType(typeof(string), StatusCodes.Status200OK)]
  • [AllowAnonymous] *- [HttpGet],[HttpPost],[HttpPut],[HttpDelete],[HttpPatch]

This is example of implementation in Program.cs: ``` using QuickEndpoints; ...

    var builder = WebApplication.CreateBuilder(args);
    ...

    builder.Services.AddQuickEndpoints();
    ...

    var app = builder.Build();
    ...

    app.UseQuickEndpoints(q =>
    {
       q.ApiVersionSet = app.NewApiVersionSet()
       .HasApiVersion(new ApiVersion(1))
       .ReportApiVersions()
       .Build();
       q.UseOpenApiExporer = true;
    });
    app.UseSwaggerUI(options =>...) // this should be at the end if api explorer is used (swagger)
    ```

This is example of endpoint:

    ```
    [ApiVersion("1.0")]
    [Route("api/v{v:apiVersion}/[endpoint]")]
    [Produces("application/json")]
    [ProducesResponseType(typeof(object), StatusCodes.Status204NoContent)]
    public class WeatherForecastEndpoint : IQuickEndpoint
    {
        public WeatherForecastEndpoint()
        {
        }

        public string GetWeatherForecast([Required] string from, string to)
        {
                ...
        }
        ...
    }
    ```
  • Asp.Versioning.Http
  • Asp.Versioning.Mvc.ApiExplorer
  • Microsoft.AspNetCore.OpenApi
  • Microsoft.Extensions.DependencyInjection.Abstractions

Contact and Contribute

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
1.0.0 168 11/15/2024