Wire.NET
0.6.0
dotnet add package Wire.NET --version 0.6.0
NuGet\Install-Package Wire.NET -Version 0.6.0
<PackageReference Include="Wire.NET" Version="0.6.0" />
<PackageVersion Include="Wire.NET" Version="0.6.0" />
<PackageReference Include="Wire.NET" />
paket add Wire.NET --version 0.6.0
#r "nuget: Wire.NET, 0.6.0"
#:package Wire.NET@0.6.0
#addin nuget:?package=Wire.NET&version=0.6.0
#tool nuget:?package=Wire.NET&version=0.6.0
Wire <img src="https://raw.githubusercontent.com/SperoSophia/Wire/master/icon.png" width="24">
Wire is a quick, easy & extremely light-weight WebAPI framework. As an alternative to ASP.NET MVC, NancyFx, Nina, Sinatra and others. .NET based ofc.
Setup
PM> Install-Package Wire.NET
Code Example
Wire Supports all the standard http requests, GET, POST, PUT, DELETE, OPTIONS, PATCH. and setting up a request is fast too.
using Wire;
// Start the server
var server = new WireHTTPServer();
// Sample API endpoint
API.GET("/info/{message}", x => new { Message = x.Parameters.message });
// Wait for key press to terminate program
server.Wait();
so in the example of http://localhost/info/OK would return a json reponse as { Message: "OK" }
API.POST("/blog/post", x => BlogRepository.Save(x.Body.As<Post>()));
Save the body of the post to your post repositoty in this instance.
API.GET("/blog/posts", x => MyBlogPosts.Where(y => y.name.contains(x.QueryString["q"]))));
If we need to filter something out. in the case of http://localhost/blog/posts?q=first
Motivation
I like that the core essential need of applications to have a web endpoint. so a console app can have a single json endpoint as sampled above without the need of a huge and heavy framework as ASP.NET MVC. I liked how nancy decorated the reqests in to action parameters. It gave an illution of control. Modules and bootstraps. I needed a neat solution where i just throw a request to an object as above. which can be incrementally added.
for(int i = 0; i < 10; i++) {
API.GET("/"+i, x => new { Count = ${i} });
}
API bindings can be replaced runtime as well, so if something is mapped to /hello and you map another function to an existing mapping its replaced.
| 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. 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. |
-
net6.0
- Microsoft.CSharp (>= 4.7.0)
- Microsoft.Extensions.Caching.Memory (>= 6.0.1)
- System.Dynamic.Runtime (>= 4.3.0)
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 |
|---|---|---|
| 0.6.0 | 573 | 7/27/2022 |
| 0.5.1 | 514 | 7/20/2022 |
| 0.5.0 | 532 | 7/20/2022 |
| 0.4.1 | 859 | 2/27/2019 |
| 0.4.0 | 724 | 2/27/2019 |
| 0.3.39 | 1,363 | 2/24/2018 |
| 0.3.38 | 1,358 | 2/15/2018 |
| 0.3.37 | 1,372 | 2/11/2018 |
| 0.3.36 | 1,370 | 12/20/2017 |
| 0.3.35 | 1,392 | 12/13/2017 |
| 0.3.33 | 1,152 | 10/26/2017 |
| 0.3.32 | 1,088 | 10/26/2017 |
| 0.3.31 | 1,096 | 10/26/2017 |
| 0.2.0 | 1,375 | 10/25/2017 |