QuickEndpoints 1.0.0
dotnet add package QuickEndpoints --version 1.0.0
NuGet\Install-Package QuickEndpoints -Version 1.0.0
<PackageReference Include="QuickEndpoints" Version="1.0.0" />
<PackageVersion Include="QuickEndpoints" Version="1.0.0" />
<PackageReference Include="QuickEndpoints" />
paket add QuickEndpoints --version 1.0.0
#r "nuget: QuickEndpoints, 1.0.0"
#:package QuickEndpoints@1.0.0
#addin nuget:?package=QuickEndpoints&version=1.0.0
#tool nuget:?package=QuickEndpoints&version=1.0.0
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)
{
...
}
...
}
```
Related Packages
- Asp.Versioning.Http
- Asp.Versioning.Mvc.ApiExplorer
- Microsoft.AspNetCore.OpenApi
- Microsoft.Extensions.DependencyInjection.Abstractions
Contact and Contribute
Project owner
Senad Lakača, senad.lakaca@gmail.com
Git
| Product | Versions 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. |
-
net8.0
- Asp.Versioning.Http (>= 8.1.0)
- Asp.Versioning.Mvc.ApiExplorer (>= 8.1.0)
- Microsoft.AspNetCore.OpenApi (>= 8.0.10)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
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 |