Better SPA Routing
hlanderdev opened this issue · comments
Just recording some key points of discussion on improving routing in Plenti. Expect this issue to be edited as more ideas and points are made.
Currently, Plenti's routing is entirely content-driven, meaning routing is determined by the directory structure and JSON content file names in the content/
folder. These routes should align with Svelte components in the layouts/content/
directory. This routing is done in a single page application (SPA) style, meaning the page does not do a reload when routing. This means that your routes do not actually exist on the server. If you try to go directly to a nested route you would get a 404. Plenti handles this by creating HTML fallbacks, which load in the SPA.
We need a way for the developer to extend the base routing, for example in a case where they want routes that do not require Plenti content but use an external API. There are some key issues to think about when trying to figure out the best way to implement this.
- Generating HTML fallbacks of the custom routes
- Cohesion with the content-driven routing
- Allow for path parameters (i.e. /orders/:id/)
Note: I will update this issue later with more details, as well as some different ideas we had and their drawbacks.