Jester requires usage of std/re to set a set a wild-pattern matching any route.
The problem is that I'm using custom re and thus can't import std/re as re. But when I import it with different name Jester won't work.
import jester
from re as nim_re import nil
routes:
get nim_re.re".*":
resp "hi"
Error:
./play.nim
stack trace: (most recent call last)
/.nimble/pkgs/jester-0.5.0/jester.nim(1359, 20) routes
/.nimble/pkgs/jester-0.5.0/jester.nim(1206, 20) routesEx
/.nimble/pkgs/jester-0.5.0/jester.nim(1063, 20) processRoutesBody
/.nimble/pkgs/jester-0.5.0/jester.nim(912, 41) createRoute
/.nimble/pkgs/jester-0.5.0/jester.nim(866, 15) determinePatternType
/nim-1.4.2/lib/core/macros.nim(602, 24) expectKind
play.nim(26, 1) template/generic instantiation of `routes` from here
play.nim(27, 13) Error: Expected a node of kind nnkIdent, got nnkDotExpr
Indeed it works! Thanks! :)
import jester
from re as nim_re import nil
proc run =
routes:
let re = nim_re.re
get re".*":
resp "hi"
run()