A black and white image of the author Kolja Dummann

introducing logv.http - a event driven webserver for .net.

While I was working on the trainmonitor project I need a back-end server that could handle the HTTP API. The normal .Net way would be to use ASP.Net and do it with MVC, but since my back-end should run on Mono I don’t wanted to go that painful road with Mono and decided to do some stuff on my own.

That’s when logv.http was born a simple webserver written in .Net. It is not fully written by my own it is mostly a wrapper around the HttpListener class in the framework but it takes away many of the annoying work from you with a simple API and does not have the large footprint like using ASP.

Creating a “hello world” looks like this

var server = new Server("localhost", 13337);

server.Get("http://localhost:13337" ,(req, res) => res.Write("Hello World!"));

server.Start();

But the project contains many more stuff like, helpers for setting caching responding with JSON serialized objects. To do so simply replace the second line with:

server.Get("http://localhost:13337" ,(req, res) => res.WriteAsJson(new {Hello = "world"}));

And the server will response with a JSON string. There are also helpers for all kinds of error messages and other response codes, simply try it out!

You can find the NuGet Package here. And of course everything is open source under the Apache 2.0 license. The source code is on Github. If you want to report bugs or implement features just sent me a pull request or create an issue there.