Skip to content

Instantly share code, notes, and snippets.

@wuzhenlin135
wuzhenlin135 / program.cs
Created November 12, 2018 08:51 — forked from wqweto/program.cs
Minimal .Net Web Server with Regex Routing in 177 LOC of C#
//
// Poor Man's Web Server with Regex Routing in 177 LOC of C#
//
// This is a simple standalone http server that handles routing with regular expressions
// matching. For each request the router passes capture groups to handlers as a data dictionary.
//
// Router implementation constructs a single composite regex to match request path, based on
// https://nikic.github.io/2014/02/18/Fast-request-routing-using-regular-expressions.html
//
// One can use `WebServer` and `Router` classes alone, just has to register all custom
@wuzhenlin135
wuzhenlin135 / ClientConsole
Created November 12, 2018 06:48
non blocking client server with httplistener
using System;
using System.Net;
using System.Threading;
using System.Threading.Tasks;
namespace ClientConsole
{
static class Program
{