src/prologue/core/route

Types

PrologueError = object of CatchableError
  Source Edit
RouteError = object of PrologueError
  Source Edit
RouteResetError = object of RouteError
  Source Edit
DuplicatedRouteError = object of RouteError
  Source Edit
DuplicatedReversedRouteError = object of RouteError
  Source Edit
UrlPattern = tuple[route: string, matcher: HandlerAsync, httpMethod: seq[HttpMethod],
                 name: string, middlewares: seq[HandlerAsync]]
  Source Edit

Procs

proc stripRoute(route: string): string {...}{.inline, raises: [], tags: [].}
  Source Edit
proc initPath(route: string; httpMethod = HttpGet): Path {...}{.raises: [], tags: [].}
  Source Edit
proc initRePath(route: Regex; httpMethod = HttpGet): RePath {...}{.raises: [], tags: [].}
  Source Edit
proc pattern(route: string; handler: HandlerAsync; httpMethod = HttpGet; name = "";
            middlewares: sink seq[HandlerAsync] = @[]): UrlPattern {...}{.raises: [],
    tags: [].}
  Source Edit
proc pattern(route: string; handler: HandlerAsync; httpMethod: sink seq[HttpMethod];
            name = ""; middlewares: sink seq[HandlerAsync] = @[]): UrlPattern {...}{.
    raises: [], tags: [].}
  Source Edit
proc hash(x: Path): Hash {...}{.raises: [], tags: [].}
  Source Edit
proc newPathHandler(handler: HandlerAsync;
                   middlewares: sink seq[HandlerAsync] = @[];
                   settings: Settings = nil): PathHandler {...}{.inline, raises: [], tags: [].}
  Source Edit
proc newRouter(): Router {...}{.inline, raises: [], tags: [].}
  Source Edit
proc newReRouter(): ReRouter {...}{.inline, raises: [], tags: [].}
  Source Edit
proc add(reRouter: ReRouter; pairs: (RePath, PathHandler)) {...}{.inline, raises: [], tags: [].}
  Source Edit
proc `[]`(router: Router; path: Path): PathHandler {...}{.inline, raises: [KeyError], tags: [].}
  Source Edit
proc `[]=`(router: Router; path: Path; pathHandler: PathHandler) {...}{.inline, raises: [],
    tags: [].}
  Source Edit
proc hasKey(router: Router; path: Path): bool {...}{.inline, raises: [], tags: [].}
  Source Edit
proc findHandler(ctx: Context): PathHandler {...}{.
    raises: [KeyError, RouteError, Exception], tags: [RootEffect].}
fixed route -> regex route -> params route Follow the order of addition.   Source Edit

Iterators

iterator pairs(router: Router): (Path, PathHandler) {...}{.inline, raises: [], tags: [].}
  Source Edit
iterator items(reRouter: ReRouter): (RePath, PathHandler) {...}{.inline, raises: [], tags: [].}
  Source Edit