simpleapi.core
1.0.2
See the version list below for details.
dotnet add package simpleapi.core --version 1.0.2
NuGet\Install-Package simpleapi.core -Version 1.0.2
<PackageReference Include="simpleapi.core" Version="1.0.2" />
paket add simpleapi.core --version 1.0.2
#r "nuget: simpleapi.core, 1.0.2"
// Install simpleapi.core as a Cake Addin #addin nuget:?package=simpleapi.core&version=1.0.2 // Install simpleapi.core as a Cake Tool #tool nuget:?package=simpleapi.core&version=1.0.2
simple-api project
simple-api project is an attempt to create a framework for creating very transparent in terms of code and efficient API-type applications. In accordance with the principle of Domain Driven Design, each endpoint is a separate class, which allows for very simple work on the entire project.
The framework allows you to
- Creating API interface (http/https)
- Middlewares implementations
- Dependency injection *
- Simple UI for testing and creating documentation *.
- Web page construction *
implementation
Construction of the API interface
If you want to start a server
IApp app = App.Init<Program>(5050)
app.Run();
Construction of Endpoints
[Api("/example", Method.GET)]
public static class ExampleEndpoint
{
public class Command
{
public int A { get; set; }
public int B { get; set; }
public int C { get; set; }
}
public class Handler : IEndpoint<Command, int>
{
public async Task<int> Handle(Command command)
{
//TODO all features
return command.A + command.B + command.C;
}
}
}
Command is a class that has a request body in it if it is a GET it will be taken from the parameters in the URL, if it is a method that has a body it will be built from JSON
Construction of Middleware
if you want to create middleware you must instantiate the class
public class ExampleMiddleware : IMiddleware
{
public async Task<HttpListenerContext> Invoke(HttpListenerContext ctx)
{
Console.WriteLine("TODO somethink cool");
return ctx;
}
}
And then register it on the App object
IApp app = App.Init<Program>(5050)
.AddMiddleware<ExampleMiddleware>();
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
-
net7.0
- Newtonsoft.Json (>= 13.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
alpha