My experience with using SvelteKit in my personal projects has been quite enjoyable. However, coming from a background of working with frameworks like Next.js and Nuxt.js, I often find myself confused about where the code I write actually runs.
In my day job, I primarily use the ASP.NET Core platform to build traditional web applications. In this environment, it's clear to me where the code I write is executed. Frontend markup is written in Razor pages, which are then processed by the server to generate HTML for the browser to render.
On the other hand, JavaScript frameworks like SvelteKit, Next.js, and Nuxt.js present a different workflow that has always puzzled me. While I understand the basics of file-based routing and component frameworks used by these frameworks, the actual process of code execution remains unclear to me.
For instance, in SvelteKit, navigating between pages does not trigger page reloads in the browser, indicating some form of client-side routing is being utilized. This raises questions about where the code I write in SvelteKit is actually running. Is it compiled and sent to the browser on initial load, or is it executed within the browser itself?
Furthermore, I wonder if these frameworks have an internal HTTP server to handle certain web requests. Can I create HTTP handlers in SvelteKit to manage form submissions, similar to how I would approach it in ASP.NET? Alternatively, should I rely on a separate Node.js and Express server to communicate with databases and handle other operations?
These uncertainties may seem basic to seasoned JavaScript developers, but as someone accustomed to working with MVC frameworks like ASP.NET, they continue to puzzle me.