How to use Netlify Functions in SvelteKit Applications

แชร์
ฝัง
  • เผยแพร่เมื่อ 16 ม.ค. 2025

ความคิดเห็น • 1

  • @pickavana8056
    @pickavana8056 2 ปีที่แล้ว

    Hi Ekene. In a short space of time, Sveltekit 1.0 has changed. No need to init at installation. Still seems to be issues running locally. ntl deploy wants a "build" folder and sveltekit now is creating a .svelte-kit folder. My netlify.toml file has [build] command="svelte-kit build" publish="build". My svelte.config.js imports adapter-netlify. But I cant run locally and online at the same time. If I run ntl dev it displays app fine locally. If I run ntl deploy it prompts me to build. I run npm run build, which creates a build folder. I run ntl deploy and it looks fine online. But now, if I try ntl dev, locally the site is a mess - navigation, css, nothing working. If I delete the build folder and run ntl dev then the site is again working locally. So for now, I can work with that.
    You show how to create a netlify function and as you said thats the smallest function ever. How about a function that loads some data from a website and a +page.svelte that a button click runs that function and displays fetched data. Much more useful.
    Have you played with 1.0 yet?