public MainForm() { InitializeComponent(); var domain = "http://localhost:8888/"; var routings = new string[] { domain }; var helloWorldMiddleware = new HelloWorldMiddeware("/helloworld"); var weatherMiddeware = new WeatherMiddleware("/weather"); helloWorldMiddleware.LinkWith(weatherMiddeware); httpServer = new CustomHttpServer(routings, helloWorldMiddleware); task = new Task(async() => await httpServer.Listen()); task.Start(); LogMsg("HttpServer was stated for listening ..."); LogMsg(string.Format("Domain: {0}", domain)); LogMsg("Endpoints:"); LogMsg("1) helloworld"); LogMsg("2) weather"); LogMsg("Try in browser:"); LogMsg(string.Format("1) {0}helloworld", domain)); LogMsg(string.Format("2) {0}weather", domain)); }
static void Main(string[] args) { try { var server = new CustomHttpServer(8080); server.Listen(); } catch (Exception ex) { var i = ""; } }