GitHub - Code-Sharp/uHttpSharp at be51261d22af8ed9efa4e3f41d62977905b47404 · GitHub
Skip to content

About

A very lightweight & simple embedded http server for c#

Resources

Stars

112 stars

Watchers

8 watching

Forks

Repository files navigation

µHttpSharp Build status

A very lightweight & simple embedded http server for c#

Usage :

using (var httpServer = new HttpServer(800, new HttpRequestProvider()))
{
	httpServer.Use((context, next) => {
		Console.WriteLine("Got Request!");
		return next();
	});

	httpServer.Use(new TimingHandler());
	httpServer.Use(new HttpRouter().With(string.Empty, new IndexHandler())
									.With("about", new AboutHandler()));
	httpServer.Use(new FileHandler());
	httpServer.Use(new ErrorHandler());
	
	httpServer.Start();
	Console.ReadLine();
}

Under Construction

µHttpSharp is going through heavy modifications to be more like koa :

  • new IHttpContext interface (Gathers IHttpResponse, IHttpRequest and maybe even session)
  • new httpServer.Use((context, next) => { next(); }); syntax

More modifications will be made to make it more "user friendly" out of the box :

  • Adding RESTful controllers
  • Creating a nuget package

Performance

µHttpSharp managed to handle 2000 requests a sec on core i5 machine, cpu was 100%, memory consumption and number of threads was stable.

That's nice, Not good as koa, But i'm going to try push it further.

How To Contribute?

  • Use it
  • Open Issues
  • Fork and Push requests

About

A very lightweight & simple embedded http server for c#

Resources

Stars

112 stars

Watchers

8 watching

Forks

Releases

Packages

Contributors

Languages