RHttpServer 3.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package RHttpServer --version 3.0.0
                    
NuGet\Install-Package RHttpServer -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="RHttpServer" Version="3.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="RHttpServer" Version="3.0.0" />
                    
Directory.Packages.props
<PackageReference Include="RHttpServer" />
                    
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 RHttpServer --version 3.0.0
                    
#r "nuget: RHttpServer, 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.
#addin nuget:?package=RHttpServer&version=3.0.0
                    
Install as a Cake Addin
#tool nuget:?package=RHttpServer&version=3.0.0
                    
Install as a Cake Tool

Example

// We serve static files, such as index.html from the 'public' directory
var server = new RedHttpServer(5000, "public");

// URL param demo
server.Get("/:param1/:paramtwo/:somethingthird", async (req, res) =>
{
	await res.SendString($"URL: {req.Parameters["param1"]} / {req.Parameters["paramtwo"]} / {req.Parameters["somethingthird"]}");
});

// Redirect to page on same host
server.Get("/redirect", async (req, res) =>
{
	await res.Redirect("/redirect/test/here");
});

// Save uploaded file from request body 
Directory.CreateDirectory("uploads");
server.Post("/upload", async (req, res) =>
{
	if (await req.SaveFiles("uploads"))
		await res.SendString("OK");
	else
		await res.SendString("Error", status: HttpStatusCode.NotAcceptable);
});

server.Get("/file", async (req, res) =>
{
	await res.SendFile("testimg.jpeg");
});

// Handling formdata from client
server.Post("/formdata", async (req, res) =>
{
	var form = await req.GetFormDataAsync();
	await res.SendString("Hello " + form["firstname"]);
});

// Using url queries to generate an answer
server.Get("/hello", async (req, res) =>
{
	var queries = req.Queries;
	await res.SendString($"Hello {queries["firstname"]} {queries["lastname"]}, have a nice day");
});

// WebSocket echo server
server.WebSocket("/echo", async (req, wsd) =>
{
	await wsd.SendText("Welcome to the echo test server");
	wsd.OnTextReceived += (sender, eventArgs) =>
	{
		wsd.SendText("you sent: " + eventArgs.Text);
	};
});
server.Start();
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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. 
.NET Core netcoreapp2.0 is compatible.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (7)

Showing the top 5 NuGet packages that depend on RHttpServer:

Package Downloads
Red.CookieSessions

Simple session management middleware for RedHttpServer. Uses cookies with authentication tokens

Red.JwtSessions

Package Description

Butterfly.Web.RedHttpServer

Implementation of Butterfly.Web for RedHttpServer (see https://github.com/rosenbjerg/Red)

Red.HandlebarsRenderer

Extension for Red for rendering Handlebars templates as responses

Red.EcsRenderer

Extension for Red for rendering .ecs files

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
5.2.1 14,105 3/16/2020 5.2.1 is deprecated because it is no longer maintained.
5.2.0 1,660 3/1/2020 5.2.0 is deprecated because it is no longer maintained.
5.1.0 3,172 2/22/2020 5.1.0 is deprecated because it is no longer maintained.
5.0.0 1,576 2/21/2020 5.0.0 is deprecated because it is no longer maintained.
4.0.2 13,659 9/23/2019 4.0.2 is deprecated because it is no longer maintained.
4.0.1 1,569 9/16/2019 4.0.1 is deprecated because it is no longer maintained.
4.0.0 4,893 4/29/2019 4.0.0 is deprecated because it is no longer maintained.
3.5.2 6,101 9/12/2018 3.5.2 is deprecated because it is no longer maintained.
3.5.1 1,787 9/7/2018 3.5.1 is deprecated because it is no longer maintained.
3.5.0 1,960 8/17/2018 3.5.0 is deprecated because it is no longer maintained.
3.4.0 1,875 8/15/2018 3.4.0 is deprecated because it is no longer maintained.
3.3.0 1,919 8/13/2018 3.3.0 is deprecated because it is no longer maintained.
3.2.2 2,042 8/6/2018 3.2.2 is deprecated because it is no longer maintained.
3.2.1 2,321 6/27/2018 3.2.1 is deprecated because it is no longer maintained.
3.2.0 2,889 6/26/2018 3.2.0 is deprecated because it is no longer maintained.
3.1.0 3,157 5/20/2018 3.1.0 is deprecated because it is no longer maintained.
3.0.0 6,070 3/26/2018 3.0.0 is deprecated because it is no longer maintained.
2.0.5 3,232 10/16/2017 2.0.5 is deprecated because it is no longer maintained.
2.0.4 2,232 10/16/2017 2.0.4 is deprecated because it is no longer maintained.
2.0.3 2,671 5/13/2017 2.0.3 is deprecated because it is no longer maintained.
2.0.2 2,727 4/27/2017 2.0.2 is deprecated because it is no longer maintained.
2.0.1 2,723 4/23/2017 2.0.1 is deprecated because it is no longer maintained.
2.0.0 2,842 4/12/2017 2.0.0 is deprecated because it is no longer maintained.
1.0.4.4 2,156 1/25/2017 1.0.4.4 is deprecated because it is no longer maintained.
1.0.4.3 2,219 1/24/2017 1.0.4.3 is deprecated because it is no longer maintained.
1.0.4.2 2,181 1/9/2017 1.0.4.2 is deprecated because it is no longer maintained.
1.0.4.1 2,616 12/12/2016 1.0.4.1 is deprecated because it is no longer maintained.
1.0.4 2,466 12/12/2016 1.0.4 is deprecated because it is no longer maintained.
1.0.3.9 2,174 12/9/2016 1.0.3.9 is deprecated because it is no longer maintained.
1.0.3.8 2,093 12/3/2016 1.0.3.8 is deprecated because it is no longer maintained.
1.0.3.7 2,472 11/8/2016 1.0.3.7 is deprecated because it is no longer maintained.
1.0.3.6 2,169 10/25/2016 1.0.3.6 is deprecated because it is no longer maintained.
1.0.3.5 2,095 10/13/2016 1.0.3.5 is deprecated because it is no longer maintained.
1.0.3.4 2,376 10/5/2016 1.0.3.4 is deprecated because it is no longer maintained.
1.0.3.3 2,186 9/27/2016 1.0.3.3 is deprecated because it is no longer maintained.
1.0.3.2 2,225 9/25/2016 1.0.3.2 is deprecated because it is no longer maintained.
1.0.3.1 2,387 9/22/2016 1.0.3.1 is deprecated because it is no longer maintained.
1.0.3 2,415 9/22/2016 1.0.3 is deprecated because it is no longer maintained.
1.0.2.11 2,433 9/17/2016 1.0.2.11 is deprecated because it is no longer maintained.
1.0.2.10 2,200 9/14/2016 1.0.2.10 is deprecated because it is no longer maintained.
1.0.2.9 2,114 9/14/2016 1.0.2.9 is deprecated because it is no longer maintained.
1.0.2.8 2,658 9/13/2016 1.0.2.8 is deprecated because it is no longer maintained.
1.0.2.7 2,089 9/12/2016 1.0.2.7 is deprecated because it is no longer maintained.
1.0.2.6 2,123 9/12/2016 1.0.2.6 is deprecated because it is no longer maintained.
1.0.2.5 2,123 9/12/2016 1.0.2.5 is deprecated because it is no longer maintained.
1.0.2.4 2,603 9/11/2016 1.0.2.4 is deprecated because it is no longer maintained.
1.0.2.3 2,091 9/11/2016 1.0.2.3 is deprecated because it is no longer maintained.

Re-design of some parts. Introducing a simple yet reasonable powerful middleware and extension system