コード例 #1
0
ファイル: RegexRoute.cs プロジェクト: headdetect/WebSharp
 public RegexRoute(Regex expression, HttpRouter.GenericRouteHandler handler)
     : this(expression, (a, b, c) => handler(b, c))
 {
 }
コード例 #2
0
ファイル: RegexRoute.cs プロジェクト: headdetect/WebSharp
 public RegexRoute(Regex expression, HttpRouter.GenericRouteHandler handler, object defaults)
     : this(expression, (a, b, c) => handler(b, c), defaults)
 {
 }
コード例 #3
0
ファイル: BootStats.cs プロジェクト: headdetect/BootStats
        static void SetupRoutes()
        {
            var httpd = new HttpServer();
            var router = new HttpRouter();

            httpd.Request = router.Route;
            httpd.LogRequests = Config.Log;

            var staticResources = new StaticContentHandler("./Static");
            router.AddRoute(new StaticContentRoute(staticResources));

            var mvc = new MvcRouter();

            mvc.RegisterController(new IndexController());
            mvc.RegisterController(new AdminController());
            mvc.RegisterController(new TestController());

            // Index //
            mvc.AddRoute("Login", "/", new { controller = "Index", action = "Index" });
            mvc.AddRoute("Login", "{action}", new { controller = "Index", action = "DoLogin" });

            mvc.AddRoute("Admin", "{controller}", new { controller = "Admin", action = "Index" });

            mvc.AddRoute("Test", "{action}", new { controller = "Test", action = "TestRedirect" });

            router.AddRoute(mvc);

            httpd.Start(new IPEndPoint(IPAddress.Parse(Config.BindingAddress), Config.BindingPort));

            Console.WriteLine("Server started on port " + Config.BindingPort);
        }