Beispiel #1
0
        static void Main(string[] args)
        {
            TemplateHandler templatetest = new TemplateHandler();

            templatetest.RegisterHooks("templatetest");
            templatetest.ResponseMime = "text/plain";
            templatetest.TemplateText = "Template test. Query parameters: {{query}}";
            templatetest.GetHandler  += templatetest_GetHandler;



            EmbeddedHttpServer server = new EmbeddedHttpServer(8080);

            server.Path = Environment.CurrentDirectory;
            server.Handlers.Add(templatetest);
            server.LogDir = Path.Combine(Environment.CurrentDirectory, "Log");
            server.AppPackages.Add(Path.Combine(Environment.CurrentDirectory, "webdev.zip"));
            server.Start();
            Console.WriteLine("Server running. Press ESC to quit");
            ConsoleKeyInfo key;

            do
            {
                key = Console.ReadKey();
            }while (key.Key != ConsoleKey.Escape);
            server.Stop();
        }