What kind of stuff do you give up with an SPA?
You give up server redirects and cookie auth. (well you don't lose cookie auth, but you need extra steps for it to prevent CSRF)
Re:
by stackghost on Friday November 29, 2024 @02:11PM
(#42276220)
You can just have the server return a json object instructing the frontend to navigate, accomplishing server redirects.
Javascript can do browser redirects, but those are not actual 301 HTTP redirects.
Re:
by stackghost on Friday November 29, 2024 @08:44PM
(#42278743)
Yes, what I'm saying is that you can have the backend return e.g. "{ "response": 301, "redirectUrl": "https://example.com" }", and then have the frontend handle that properly, and you get the functional equivalent.
I'm aware that it is different under the hood.
This is why I typically fight SPAs every step of the way with our clients, if any other architecture will work I see if there is a good case to be made for it, because I know that SPAs are usually going to end up shipping broken in some way.