bung87 / scorper

scorper is a micro and elegant web framework written in Nim
Apache License 2.0
80 stars 6 forks source link

attempting to call undeclared routine: 'hasCustomPragma' #26

Closed sdmcallister closed 3 years ago

sdmcallister commented 3 years ago

Seems to raise error at compile time.

C:\Users\\\nimdash_hold\experiments\scorpertest.nim(19, 4) template/generic instantiation of `addRoute` from here
C:\Users\\.nimble\pkgs\scorper-1.0.13\scorper\http\routermacros.nim(12, 15) Error: attempting to call undeclared routine: 'hasCustomPragma' 
import scorper

const port{.intdefine.} = 8888
when isMainModule:
  type AsyncCallback = proc (request: Request): Future[void] {.closure, gcsafe.}

  proc handler(req: Request) {.route("get","/one"),async.} = discard
  proc handler2(req: Request) {.route(["get","post"],"/multi"),async.} = discard
  let r = newRouter[AsyncCallback]()
  r.addRoute(handler)
  r.addRoute(handler2)

  const address = "127.0.0.1:" & $port
  const flags = {ReuseAddr}
  var server = newScorper(address, r, flags)
  server.start()
  waitFor server.join()
bung87 commented 3 years ago

could you tryimport macros , it seems old template issue, it doesn't export symbols in template

bung87 commented 3 years ago

close in https://github.com/bung87/scorper/commit/d1f9400386921b90e1a272ad7f0f94a6f319f866