src/happyx/routing/routing

Provides powerful routing ✨

Procs

proc convertJson(self: RequestModelData; body: string): JsonNode {.
    ...raises: [IOError, OSError, KeyError, ValueError],
    tags: [ReadIOEffect, WriteIOEffect], forbids: [].}
Converts Request JSON to Python dict
proc getRouteParams(routeData: RouteDataObj;
                    found_regexp_matches: seq[RegexMatch2];
                    urlPath: string = "";
                    handlerParams: seq[HandlerParam] = @[]; body: string = "";
                    force: bool = false): RouteObject {.
    ...raises: [IOError, OSError, KeyError, ValueError],
    tags: [ReadIOEffect, WriteIOEffect], forbids: [].}
Finds and exports route arguments
proc parseBoolOrJString(str: string): JsonNode {....raises: [], tags: [],
    forbids: [].}
proc parseFloatOrJString(str: string): JsonNode {....raises: [], tags: [],
    forbids: [].}
proc parseIntOrJString(str: string): JsonNode {....raises: [], tags: [],
    forbids: [].}

Macros

macro pathParams(body: untyped): untyped

pathParams provides path params assignment ✨.

Simple usage:

pathParams:
  # means that `arg` of type `int` is optional param with default value `5`
  arg? int = 5
  # means that `arg1` of type `string` is optional param with default value `"Hello"`
  arg1 = "Hello"
  # means that `arg2` of type `float` is param
  arg2 float
  # means that `arg3` of type `int` is optional param with default value `10`
  arg3:
    type int
    optional
    default = 10