public IRoute Add(string method, string name, string routePattern, RouteFuncAsync handler) { var route = new Route(method, name, GetPrefixedRoute(routePattern), handler); _routeManager.Add(route); return(route); }
internal Route(string method, string name, string route, RouteFuncAsync handlerFunc) { _middlewareManager = new MiddlewareManager(); _method = method; _name = name; _route = route; _handlerFunc = handlerFunc; _regex = RouteToRegex(route); }
public MiddlewareRuntime( IEnumerable <RouteFuncAsyncMiddleware> routeFuncAsyncMiddlewareList, RouteFuncAsync handlerFunc ) { _handlerFunc = handlerFunc; foreach (var routeFuncAsyncMiddleware in routeFuncAsyncMiddlewareList) { var middleware = new Middleware { Next = context => _handlerFunc(context), HandlerFunc = routeFuncAsyncMiddleware }; if (_middleware == null) { _middleware = middleware; } else { _middleware.Next = middleware.Invoke; } } }
public RequestHandler(RouteFuncAsync handlerFunc, Context context) { _handlerFunc = handlerFunc; _context = context; }
public MiddlewareRuntime GetRuntime(RouteFuncAsync handlerFunc) { return(new MiddlewareRuntime(_middleware, handlerFunc)); }
public static IRoute Patch(this IRouteConfigurator routeConfigurator, string name, string path, RouteFuncAsync handler) { return(routeConfigurator.Add("PATCH", name, path, handler)); }
public static IRoute Trace(this IRouteConfigurator routeConfigurator, string name, string path, RouteFuncAsync handler) { return(routeConfigurator.Add("TRACE", name, path, handler)); }
public static IRoute Options(this IRouteConfigurator routeConfigurator, string name, string path, RouteFuncAsync handler) { return(routeConfigurator.Add("OPTIONS", name, path, handler)); }
public static IRoute Connect(this IRouteConfigurator routeConfigurator, string name, string path, RouteFuncAsync handler) { return(routeConfigurator.Add("CONNECT", name, path, handler)); }
public static IRoute Delete(this IRouteConfigurator routeConfigurator, string name, string path, RouteFuncAsync handler) { return(routeConfigurator.Add("DELETE", name, path, handler)); }
public static IRoute Head(this IRouteConfigurator routeConfigurator, string name, string path, RouteFuncAsync handler) { return(routeConfigurator.Add("HEAD", name, path, handler)); }