ThomasTJdev / nim_websitecreator

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

Fix #86 #87

Closed juancarlospaco closed 5 years ago

juancarlospaco commented 5 years ago
ThomasTJdev commented 5 years ago

Fast 💨 !!

The routes placement needs to be changed. It will eat all the routes below, so they will not be accessible, e.g.:

  1. get "/sitemap.xml":
  2. All plugin routes
ThomasTJdev commented 5 years ago

Plugin URL's will not be included:

https://github.com/ThomasTJdev/nim_websitecreator/blob/f977bbe45eca5abea6710af04aa15193e93051f8/nimwcpkg/nimwc_main.nim#L526-L537

juancarlospaco commented 5 years ago

I dont know how to fix that, maybe is not so easy...

This wont work

const pageRoutes = """

get re"/*.":
  createTFD()
  const sql_page = sql"SELECT id FROM pages WHERE url = ?"
  resp genPage(c, getValue(db, sql_page, c.req.path))

"""

macro generateRoutes(): typed =
  var extensions = staticRead("resources/web/routes.nim")

  for ppath in pluginsPath:
    extensions.add("\n\n" & staticRead(ppath & "/routes.nim"))

  extensions.add(pageRoutes)

  result = parseStmt(extensions)

generateRoutes()

:thinking: :thought_balloon:

ThomasTJdev commented 5 years ago

It's purely a cosmetic thing :) . I couldn't find a good solution, so that's why I chose the /p/, which fixed the colliding routes.

juancarlospaco commented 5 years ago

If you have any fix feel free to push here directly.

juancarlospaco commented 5 years ago

I think the breakage and incompatibilities dont worth the cosmetic improvement.

We tried tho, but I want to Close this one, Wont Fix, what do you think @ThomasTJdev :grey_question:

ThomasTJdev commented 5 years ago

I think the breakage and incompatibilities dont worth the cosmetic improvement.

We tried tho, but I want to Close this one, Wont Fix, what do you think @ThomasTJdev ❔

Agree