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();
}
µHttpSharp is going through heavy modifications to be more like koa :
- new
IHttpContextinterface (GathersIHttpResponse,IHttpRequestand maybe even session) newhttpServer.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
µ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.
- Use it
- Open Issues
- Fork and Push requests
