4 ms·
I typically keep all my SPA routes/route names in a single JSON, and then reference those from the App, instead of repeating the routes everywhere. I can then p
by ch_sm 3y ago
I typically keep all my SPA routes/route names in a single JSON, and then reference those from the App, instead of repeating the routes everywhere. I can then pass those to the server to let it know what the SPA can handle.
- antihero 3y agoThis is an opinionated approach that is out of scope really I think. Though if it works for you, awesome!
- shkkmo 3y agoI'm not sure what is 'opinionated' about this approach. It seems like a pretty standard and reasonable way of correctly serving an SPA in a way that doesn't violate web standards.
- __jonas 3y agoSo this would mean you would have to dynamically generate your webservers configuration at the build time of your SPA? And then how are you handling routes with params inside? In your SPA they would probably be configured like /user/:id/post/:post Now you would have to translate that to something the webserver config understands, probably wildcard / glob pattern / regex stuff and splice that into the web server config? I mean it's possible, sure, but that's a lot of overhead and room for error just to deploy a simple SPA, it definitely is an opinionated approach.
- withinboredom 3y agoI don’t know. Computers are pretty damn good at transforming text. It sounds pretty simple really, it’s probably less than a week to build something rock solid.
- boredtofears 3y agoI'd say not handling 404's correctly and simply returning a 200 OK is pretty opinionated, too.
- rizky05 3y ago[dead]