I’m trying to use one index page for all my nested paths and I can’t figure out how to set the base path to load the initial index.html.js
always from localhost/index.html.js
. E.g.:
- normal path which works: <http://localhost>
-> loads <http://localhost/index.html.js>
- nested path which doesn’t work: <http://localhost/nested/path>
-> tries to load <http://localhost/nested/index.html.js>
Is it possible to configure a base-path somewhere or should I handle this server-side and define some catch-all route to the index.html.js
?
@freakinruben are you looking for a single page app?
yes
paths start with #
yeah, but I want to use html5history api.. which works if I start navigating from index page.. But if I click on a link, and then refresh I get the problem described above 😉
html5history api can ofcourse be used with #
, but I’m trying to do it without
so that would be on the server side of things then
if it works before a refresh then the issue is the path attempting to load from the server
right, unless there is a possibility to define a <base .. >
in the generated html by hoplon
if I just go to localhost/nested/path
how does it know to use the index page? It would need a server which always returns the index no matter the path
true, I have a catch all handler that always returns the hoplon generated index.html. The problem is inside the generated index.html, which tries to load the index.html.js
from a relative path
ah I see what you mean,
if it’s not possible, I can try to define a catch-all route for the index.html.js
so it’s always returned, but from a caching perspective that’s not optimal
we have a base
element
https://github.com/hoplon/hoplon/blob/master/src/hoplon/core.cljs#L452