ThomasTJdev / nim_websitecreator

Nim fullstack website framework - deploy a website within minutes
https://nimwc.org
MIT License
176 stars 7 forks source link

Jester 0.4.0 supports `extend`which could ease implementation of modules #12

Closed ThomasTJdev closed 6 years ago

ThomasTJdev commented 6 years ago

Checkout current solution vs Jester 0.4.0:

# Included from module folder
router moduleX:
  get "/moduleX/settings":
    resp ("Settings")

# Main routes
routes:
  extend moduleX, ""

  get "/":
    resp ("Main routes")
ThomasTJdev commented 6 years ago

Closed. By using extend the plugins can get into trouble, if they use procs in nimwc_main.nim, which are defined after the routes.nim file is imported. The same problem arises, if the plugin imports the routes.nim due to the plugin being imported before the procs.

The procs are not being moved at the moment since c: var TData cannot be exported.

This could be solved moving all procs out of nimwc_main.nim.