Skip to content

Latest commit

 

History

History
51 lines (39 loc) · 1.2 KB

README.md

File metadata and controls

51 lines (39 loc) · 1.2 KB

Ezra

Ezra is a HTTP web server built based over the orinal protocol specification using TDD since the very beggining.

Ezra is a fully recreational project made for learning and not intended to be used in production.

Usage

using Ezra;

public static class Program
{
    public static void Main(string[] args)
    {
        new EzraServer()
            .MapHandler("/hello", new EchoHandler("hello"))
            .MapHandler("/ok", new EchoHandler("ok"))
            .Start(args);
    }
}

public class EchoHandler : IRequestHandler
{
    private readonly string _message;

    public EchoHandler(string message)
    {
        _message = message;
    }

    public void Handle(IRequest request, IResponse response)
    {
        System.Console.WriteLine($"{request.Method} {request.Path}");
        response.Write(_message);
    }
}

Development

The project was developed using NET 6 and VSCode in a Mac M1, so running it in a Windows/Visual Studio environment might require some tweaks.

Resources