public static void SessionInitializer(string name, Action <Session, Request> callback) { RouteCallback initializer = new RouteCallback ( priority: 1, cb: (req) => { if (req.GetSession(name) == null) { Session s = new Session(name); callback(s, req); return(new PassThrough().AddSession(s)); } return(PassThrough.Skip); } ); Routing.AddHandler(initializer); }
public static void Route(string method, RoutePatternMatch route, Response res) => Routing.AddHandler((MethodArg)method, route, res);
public static void Route(RoutePatternMatch route, RouteCallback_A callback) => Routing.AddHandler(route, callback);
public static void Delete(RoutePatternMatch route, RouteCallback_D callback) => Routing.AddHandler(HTTPMethod.DELETE, route, callback);
public static void Put(RoutePatternMatch route, RouteCallback_D callback) => Routing.AddHandler(HTTPMethod.PUT, route, callback);
public static void Get(RoutePatternMatch route, RouteCallback_B callback) => Routing.AddHandler(HTTPMethod.GET, route, callback);
public static void All(RouteCallback_D callback) => Routing.AddHandler(callback);
public static void All(HTTPMethod method, RouteCallback_D callback) => Routing.AddHandler(method, callback);
public static void Put(string route, RouteCallback_D callback) => Routing.AddHandler(HTTPMethod.PUT, (RouteArg)route, callback);
public static void Patch(string route, RouteCallback_C callback) => Routing.AddHandler(HTTPMethod.PATCH, (RouteArg)route, callback);
public static void Get(string route, RouteCallback_C callback) => Routing.AddHandler(HTTPMethod.GET, (RouteArg)route, callback);
public static void Delete(params PartialController[] controllers) => Array.ForEach(controllers, (PartialController c) => Routing.AddHandler(HTTPMethod.DELETE, (RouteArg)c.Route, c.Callback));
public static void Routes(params Controller[] controllers) => Array.ForEach(controllers, (Controller c) => Routing.AddHandler((MethodArg)c.Method, (RouteArg)c.Route, c.Callback));
public static void Route(HTTPMethod method, RoutePatternMatch route, Response res) => Routing.AddHandler(method, route, res);
public static void Route(HTTPMethod method, RoutePatternMatch route, RouteCallback_D callback) => Routing.AddHandler(method, route, callback);
public static void Route(HTTPMethod method, string route, RouteCallback_A callback) => Routing.AddHandler(method, (RouteArg)route, callback);
public static void Route(HTTPMethod method, string route, Response res) => Routing.AddHandler(method, (RouteArg)route, res);
public static void Put(string route, Response res) => Routing.AddHandler(HTTPMethod.PUT, (RouteArg)route, res);
public static void All(HTTPMethod method, Response res) => Routing.AddHandler(method, res);
public static void Delete(string route, RouteCallback_D callback) => Routing.AddHandler(HTTPMethod.DELETE, (RouteArg)route, callback);
public static void All(Response res) => Routing.AddHandler(res);
public static void Delete(string route, Response res) => Routing.AddHandler(HTTPMethod.DELETE, (RouteArg)route, res);
public static void Patch(RoutePatternMatch route, RouteCallback_C callback) => Routing.AddHandler(HTTPMethod.PATCH, route, callback);
public static void Route(string route, RouteCallback_D callback) => Routing.AddHandler((RouteArg)route, callback);
public static void Put(RoutePatternMatch route, Response res) => Routing.AddHandler(HTTPMethod.PUT, route, res);
public static void Route(string route, Response res) => Routing.AddHandler((RouteArg)route, res);
public static void Delete(RoutePatternMatch route, Response res) => Routing.AddHandler(HTTPMethod.DELETE, route, res);
public static void Route(string method, string route, RouteCallback_D callback) => Routing.AddHandler((MethodArg)method, (RouteArg)route, callback);
public static void Route(string method, string route, Response res) => Routing.AddHandler((MethodArg)method, (RouteArg)route, res);
public static void Route(string method, RoutePatternMatch route, RouteCallback_D callback) => Routing.AddHandler((MethodArg)method, route, callback);