Re:SvelteKit 1.0
by Labo333 on Wednesday December 14, 2022 @04:38PM
(#33990959)
Can you expand? I don't get how you can use SSR with another language than Node. I always thought one has to use the static adapter.
[ Parent
| on HN ]
Re:SvelteKit 1.0
by buttersbrian on Wednesday December 14, 2022 @11:50PM
(#33995351)
the backend svelte (node) can actually make calls to the separate api server and render a 'fuller' page to the client on page load.
I believe this is what is meant.
Requests are routed reverse proxy (Caddy) -> Vite (SSR) -> Python (Pyramid).
SSR calls your backend APIs and renders templates.
Example from SvelteKit page.ts here:
https://github.com/tradingstrategy-ai/frontend/blob/master/s...
Some remarks
- page.ts is routed by Vite for every HTTP request for SSR and then it will fetch() data over backend API
- If rendered in the client, fetch() hits directly the backend API
- Both cases the template is rendered using the same logic (Svelte HTML templating, CSS, JS)
- You are going to need a template language any cases, like Django's one. Alternative way to think this is that SvelteKit is just a super powerful template engine.