Closed PMunch closed 1 year ago
You just should use this for SSR/SSG projects
serve(....):
...
staticDir "public"
or
serve(....):
...
staticDir "/route" -> "public"
it doesn't log requests either
Trying happyx today and stumbled on this as well. Compiling with -d:debug will log requests.
[2024-04-05 at 22:37:29]:INFO GET::/route/mypage.html
[2024-04-05 at 22:37:29]:INFO GET::/favicon.ico
[2024-04-05 at 22:38:11]:INFO GET::/route/badpath
[2024-04-05 at 22:38:11]:WARN /route/badpath is not found.
(the above with: staticDir "/route" -> "public")
Also the public dir should be relative to working dir where nim is invoked.
what version are you use? @lorenzncode
3.8.1 (installed with atlas). FYI staticDir is working for me now. I don't have an issue now.
Please install latest version - 3.8.14
Tried to use HappyX today but I'm a bit confused. Basically I just wanted to try out a very simple SSG with some static HTML/CSS files and a route to catch the input from a form. I created my project using
hpx create --name test --kind SSG
and it created the project structure for me. I dropped some files into thepublic
folder but the server doesn't seem to serve these files. Looked at the examples and the only one which appears to do this is thenim-lang
one and it appears to serve them with thepublic
prefix on, however trying that didn't make it serve my file either. So I'm not sure if I need to do something to make HappyX serve the files from thepublic
directory or not, it doesn't log requests either so I don't really know what's going on..This was tested with the latest tagged version of HappyX (which is the 1.0.0 release) The project structure is simply the one created by
hpx create --name test --kind SSG
with an additional file added in thesrc/public
folder. The code is exactly what was generated. I looked at the nim-lang site example which has a public folder but couldn't see any special handling of it.