SAPI 3.0.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package SAPI --version 3.0.0
NuGet\Install-Package SAPI -Version 3.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="SAPI" Version="3.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SAPI --version 3.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: SAPI, 3.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.
// Install SAPI as a Cake Addin #addin nuget:?package=SAPI&version=3.0.0 // Install SAPI as a Cake Tool #tool nuget:?package=SAPI&version=3.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
SAPI - Simple API
SAPI is a library for creating APIs with C#. It's simple by design and allows for a lot of flexibility.
Installation
Add as dependency in NuGet
Install-Package SAPI -ProjectName <project>
or in your preferred IDE:
you can also use SAPI by downloading and referencing the DLL in your project.
Usage
For detailed explanation You can also see wiki wiki
// Program.cs
using SAPI;
using SAPI.Endpoints;
using Project.Endpoints;
public static void Main(string[] args)
{
// Init SAPI
Server sapi = new();
// Mount endpoints(routes)
// sapi.MountEndpoint(new Ping("ping", Method.GET)) - this is an old method - now deprecated, use this:
sapi.MountIEndpoint(new Ping());
// Finally start SAPI
sapi.Start();
}
// Endpoints/Ping.cs
using System.Net;
using SAPI.Endpoints;
using SAPI.Utilities;
namespace Project.Endpoints
{
// public class Ping : Endpoint - this is an old method - now deprecated, use this:
public class Ping : IEndpoint
{
// New things: these are the parameters for the endpoint, that were present in constructor - now they are here
public string url { get; } = "ping";
public Method method { get; } = Method.GET;
public override void Task(ref HttpListenerRequest request, ref HttpListenerResponse response)
{
Console.WriteLine("Ping!");
Utilities.HtmlResponse("Pong!", ref response);
}
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net6.0
- Newtonsoft.Json (>= 13.0.1)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on SAPI:
Package | Downloads |
---|---|
SharpSSR
SharpSSR is a web framework for building Server Side Rendered apps. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
10.0.0 | 427 | 7/26/2023 |
9.1.0 | 231 | 5/15/2023 |
9.0.0 | 209 | 5/4/2023 |
8.0.0 | 184 | 5/1/2023 |
7.0.0 | 214 | 4/25/2023 |
6.0.0 | 229 | 3/11/2023 |
6.0.0-experimental | 164 | 2/8/2023 |
5.0.1 | 234 | 12/24/2022 |
5.0.0 | 216 | 12/6/2022 |
4.0.0 | 233 | 11/9/2022 |
3.0.0 | 246 | 11/6/2022 |
2.2.0 | 223 | 10/31/2022 |
2.1.0 | 264 | 10/5/2022 |
2.0.0 | 251 | 9/28/2022 |
1.2.0 | 281 | 9/15/2022 |
1.1.0 | 302 | 9/14/2022 |
1.0.0 | 316 | 9/14/2022 |