public Task Echo() { return(ReplyMessage(new MessageResponse(Context.Request) { Data = new MessageData { { "Echo", RouteVars.Get <string>("echo") } } })); }
public async Task Route(Request routerRequest) { RouteVars = routerRequest.RouteVars; if (!RouteVars.ContainsKey("action")) { throw new Exception("Route vars do not contain `action`, be sure to set a default in your route."); } var type = GetType(); var method = type.GetMethod(RouteVars["action"]); // TODO: make this more catcheable if (method == null) { throw new Exception($"`{RouteVars["action"]}` does not exist on `{type.Name}`"); } await Dispatch((HttpContext)routerRequest.Context, method); }