Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

import not working for router defined in different file #178

Open
bolu61 opened this issue Nov 17, 2018 · 6 comments
Open

import not working for router defined in different file #178

bolu61 opened this issue Nov 17, 2018 · 6 comments
Labels

Comments

@bolu61
Copy link

bolu61 commented Nov 17, 2018

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.

@dom96 dom96 added the Bug label Nov 17, 2018
@bolu61
Copy link
Author

bolu61 commented Nov 17, 2018

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.

@dom96
Copy link
Owner

dom96 commented Nov 17, 2018

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

@bolu61
Copy link
Author

bolu61 commented Nov 18, 2018

Does that mean potentially reimplementing external routers?

@dom96
Copy link
Owner

dom96 commented Nov 20, 2018

Perhaps. But there is probably a way around this.

@Bennyelg
Copy link

Bennyelg commented May 3, 2020

Any news?

1 similar comment
@mescobal
Copy link

mescobal commented Oct 1, 2021

Any news?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants