Just to point 3. I hope I can give a hint, the problem is, that
the match is not the * but /images/*, so
router.get("/images/*", serveStaticFiles("images/"))
will look in PROJECTHOME/images/images/ for the file.
For my .css files located in
PROJECTHOME/public/styles/
I used:
router.get("/styles/*", serveStaticFiles("public/"))
if you put your images in
PROJECTHOME/public/images
router.get("/images/*", serveStaticFiles("public/"));
should work.
I ignorantly forgot to put the proper image in the image dir ;/
But it would return the default page rather than error so I
thought the route was wrong.
e.g., I browsed to /images/image.jpg and I got the default page.
I'd rather it error out(error page).
Also, I probably would still like to know how to serve the files
statically from a handler. Could I have two routes, one that does
it statically and the other with handler, for the same content?
Also, my route is
router.get("/images/*", serveStaticFiles("/"));
Does this not open up the base dir for possible attacks? Seems
like
router.get("*", serveStaticFiles("/images"));
would be better, although this won't work because it will match
anything.
Seems kinda bizarre how it works. If I serve the files in a
handler maybe I could have more control?
I guess I could look at the source for serveStaticFiles... seems
there is some functions that are used like sendFile that should
work.
@5. There is a solution, hopefully I can find the link and post
it later.
Cool, that will help speed things up.