Inertia changes things up a bit as compared to a normal API and normal Svelte;
Optionally refer to the inertia note to understand the basics, but I’d say it’s somewhat of an API replacement.
When we visit our main page (’/’), the following function in routes/web.php calls the function ‘index’ in mixescontroller.php;
The end of this function (after retrieving all the data, checking authencication, etc), looks like this:
It returns a complete page with all this data to the front-end. This data we can import in Index.svelte (in legacy mode, in runes mode it would be let .. = props);
Then we can use this data. E.g. in Index.svelte, I tell Svelte to make me a (clickable) card for every mix in my mixes list;
I send each individual mix to the MixCard, so I can use the mix name, image, etc, for the thumbnails.