I think it's implicit that when implementing an isomorphic single page app that you've also developed a private api that your client will hit for updates.
My question is, when you push code changes to your server, there will be "stale" clients out there that are still running your old client code, and then hit your api with a possibly incompatible parameters and assumptions.
I see two possible solutions:
(Api versioning is a necessity if you also have mobile app clients to support, but for just a web site, seems like a lot of unnecessary work.)
Anyone else encounter or solve this problem? Are there other options I'm missing?
A single-page application is a more modern approach to app development. It was used by Google, Facebook, Twitter, etc. A SPA is an app that works inside a browser and does not require page reloading during use. On the other hand, a multiple page application is considered a more classical approach to app development.
An SPA (Single-page application) is a web app implementation that loads only a single web document, and then updates the body content of that single document via JavaScript APIs such as XMLHttpRequest and Fetch when different content is to be shown.
An isomorphic app is a web app that blends a server-rendered web app with a single-page application. On the one hand, we want to take advantage of fast perceived performance and SEO-friendly rendering from the server.
I would suggest a combination of the two techniques. I would recommend versioning the API, and then having a version check that gets executed by the server on ever API call. If the version is not equal to the latest version you send a message back to the client that notifies them to do a full refresh.
This way your code shouldn't get bloated with a bunch of different versioning logic. You can just create a validate function that gets called at the beginning of every call and returns a message to update if the client is out of date.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With