Note: This blog post is also available at IBM DeveloperWorks.
The method of delivering content to a browser has continued to evolve over the years. In the early days, every page was a full payload. If you clicked a link, you got a new page. If you hit the back button, you were delivered a new full page.
It didn’t take long for “web apps” to emerge that took the AJAX approach to the next level where every aspect of the app was “ajax-ified.” These web apps became known as Single Page Applications (SPAs).
Apps like Gmail and Google Maps felt like desktop applications in the browser. This was a great user experience: once the web application loaded, it was fully interactive without loading another page in the browser. And there’s the rub…
The next phase in content delivery became a hybrid approach. The initial page load was fully formed HTML that the browser could receive and display. The page loaded faster and was functional upon being presented to the user. “But what about all that AJAXy web app goodness,” you ask? Well, part two of this hybrid process is to backfill the interactivity that we have grown used to and expect. The page is loaded and functional, then all of the AJAX interactions are added to enhance the experience for the user. This gave us the best of both worlds and that’s how many sites and web apps work today.
- SEO: Pages are searchable when they first load.
- Perceived performance: page loads fast and interactivity is available immediately.
- Actual performance: initial page load is typically lighter; additional requests are only made to enhance the experience.
- Better developer experience: single language codebase with better maintainability and less context switching; shared code; shared tooling.
All of this adds up to being the best of all worlds.
Despite all these advantages, Node.js isn’t the best solution for all needs. Tasks that require intensive computation are better suited for other languages. But the Node.js platform handles most typical web applications nicely.