If you want to produce good documentation, you have to really love it. Documentation is constant work to improve, prune, correct, and keep up to date. Antora makes it easier, but still.
Are there any prescribed ways for using pedestal as the backend of a single-page app? Details in 🧵
What I need is a mix of a) an api route (in this case, /graphql to lacinia), b) some static assets served out of resources (.css/js/html), and for anything else, return index.html
im playing around with catch all parameters and prefix-tree routing, but its not quite working
actually, maybe I can use the not-found interceptor
no, that doesnt quite work either
The problem is that anything I try with catchall or not-found interceptors end up being too greedy, and the route-table is not being consulted for hits first
nm, I think the not-found handler does indeed solve the problem, I just was using it wrong
The easiest solution is probably a catch-all/wildcard route with a prefix, e.g. /app/* but then you need to accept that all of your public routes have this prefix. If you do SSR then you can do a catch-all route in the frontend instead and then fetch whatever route was requested from the backend as a fixed route. I did this in another project. In my current project I keep both frontend and backend routes in a CLJC file. They go directly into the reitit frontend and are reused (with minor modifications) in the Pedestal backend.
Thanks for the detailed reply. I was able to solve it with a custom not-found-interceptor. For our case, we don’t do SSR but have a kee-frame based SPA that is loaded from a minimal index.html. But if the user navigated to a kee-frame route (say, /foo/bar) and then refreshes the browser, the backend would see GET /foo/bar. Before it was mishandling this, but with the not-found interceptor always serving the SPA if not otherwise handled by pedestal, it rehydrates the kee-frame route correctly