jester icon indicating copy to clipboard operation
jester copied to clipboard

import not working for router defined in different file

Open bolu61 opened this issue 7 years ago • 6 comments

import jester
from cgi import decodeUrl

router extern:
    get "/@testvalue":
        resp decodeUrl(@"testvalue")

If I import this router from the main file, I get the following error: Error: undeclared identifier: 'decodeUrl' Using nim 0.19.0 and jester 0.4.1.

bolu61 avatar Nov 17 '18 06:11 bolu61

I haven't gone through the source in depth, but probably has something to do with closure. The example demonstrating closure only works for single routes: macro in single source file.

let test = "test"
router extern:
    get "/":
        resp test

also fails.

bolu61 avatar Nov 17 '18 21:11 bolu61

It's because Jester tries to be clever and moves your external router into the main router :/

dom96 avatar Nov 17 '18 21:11 dom96

Does that mean potentially reimplementing external routers?

bolu61 avatar Nov 18 '18 20:11 bolu61

Perhaps. But there is probably a way around this.

dom96 avatar Nov 20 '18 00:11 dom96

Any news?

Bennyelg avatar May 03 '20 14:05 Bennyelg

Any news?

mescobal avatar Oct 01 '21 17:10 mescobal