src/happyx/sugar/sgr

Sugar 🍎

Provides syntax sugar macros

-> Macro

"/home" -> any:
  # at any HTTP method
  return "Hello, world!"

Consts

sugarRoutes = r"HappyXSugarRoutes"

Procs

proc has[T: HoleyEnum; U](e: typedesc[T]; val: U): bool
proc has[T: OrdinalEnum; U](e: typedesc[T]; val: U): bool

Macros

macro `->`(route, at, body: untyped): untyped

Syntax sugar for routing

For SPA you can use:

"/route" -> build:
  ...

For SSR you can use:

"/route" -> any:
  ...
"/otherRoute" -> get:
  ...

Example:

"/syntaxSugar" -> get:
  return "Hello, world"

Templates

template `:=`(name, value: untyped): untyped