June 14, 2023  SEONews

How To Build Server-Side Rendered (SSR) Svelte Apps With SvelteKit — Smashing Magazine


SvelteKit is a framework for building apps using Svelte. You can use SvelteKit to build a variety of apps that can vary from being a Single page application (SPA) or Server Side Rendered (SSR) application and more. In this article, Sriram shows you how to build a server-side rendered SvelteKit application and deploy it to Netlify by following this step-by-step guide.

I’m not interested in starting a turf war between server-side rendering and client-side rendering. The fact is that SvelteKit supports both, which is one of the many perks it offers right out of the box. The server-side rendering paradigm is not a new concept. It means that the client (i.e., the user’s browser) sends a request to the server, and the server responds with the data and markup for that particular page, which is then rendered in the user’s browser.

To build an SSR app using the primary Svelte framework, you would need to maintain two codebases, one with the server running in Node, along with with some templating engine, like Handlebars or Mustache. The other application is a client-side Svelte app that fetches data from the server.

The approach we’re looking at in the above paragraph isn’t without disadvantages. Two that immediately come to mind that I’m sure you thought of after reading that last paragraph:

  1. The application is more complex because we’re effectively maintaining two systems.
  2. Sharing logic and data between the client and server code is more difficult than fetching data from an...


source: https://news.oneseocompany.com/2023/06/14/how-to-build-server-side-rendered-ssr-svelte-apps-with-sveltekit-smashing-magazine_2023061446089.html

Your content is great. However, if any of the content contained herein violates any rights of yours, including those of copyright, please contact us immediately by e-mail at media[@]kissrpr.com.