/// <summary> /// Registers a route in HTTP endpoint. /// </summary> /// <param name="method">HTTP method: "get", "head", "post", "put", "delete"</param> /// <param name="route">a command route. Base route will be added to this route</param> /// <param name="action">an action function that is called when operation is invoked.</param> protected virtual void RegisterRoute(string method, string route, Func <HttpRequest, HttpResponse, RouteData, Task> action) { if (_endpoint == null) { return; } if (route[0] != '/') { route = "/" + route; } if (_baseRoute != null && _baseRoute.Length > 0) { var baseRoute = _baseRoute; if (baseRoute[0] != '/') { baseRoute = "/" + baseRoute; } route = baseRoute + route; } _endpoint.RegisterRoute(method, route, action); }
/// <summary> /// Registers a route in HTTP endpoint. /// </summary> /// <param name="method">HTTP method: "get", "head", "post", "put", "delete"</param> /// <param name="route">a command route. Base route will be added to this route</param> /// <param name="action">an action function that is called when operation is invoked.</param> protected virtual void RegisterRoute(string method, string route, Func <HttpRequest, HttpResponse, RouteData, Task> action) { if (_endpoint == null) { return; } route = AppendBaseRoute(route); _endpoint.RegisterRoute(method, route, action); }