[SOLVED] Correct Relative Asset Path Server Side Rendering vs Static File Serving


#1

My app directory structure is something like this:

root/
    main.rs -- where my server runs
    templates.rs -- where the server side rendering templates are called from, including template that calls /elm.js (I think this path works b/c I am serving the elm/ directory itself as well)
    elm/
         elm.js
         index.html -- static file that calls elm.js
        src/
            Main.elm -- path to image assets is "src/Icons/<specific image file>"
            images/ -- all my icons and other image assets

When I serve the static index.html file the image assets are loaded appropriately. However, when I load elm.js from one of my server side rendered templates, the image assets are not found. I have tried moving the assets folder to root/src/images thinking that would be the equivalent relative path to main.rs as the current path is to index.html , but that does not seem to work. Where should these assets be for the javascript file to find them when it is called from a server side template?

========================

N/M. I had the route for the server side rendered template a level lower than the static file route. By putting the routes at the same level the image assets are served appropriately.