directus-labs / examples

Integration Examples with Directus
https://directus.io/guides
MIT License
254 stars 112 forks source link

upgrade sveltekit to v1 #178

Open alexvdvalk opened 1 year ago

alexvdvalk commented 1 year ago

Upgrade Sveltekit example template to Sveltekit V1.0.0 which was just released.

alexvdvalk commented 1 year ago

Yes it would be best to use the new way of importing environmental variables. This ensures that the DB credentials are not accidentally bundled into the front end app.

I didn't want to change too many things in the first instance

I can ammend and resubmit.

freekrai commented 1 year ago

@alexvdvalk I think it would be a good idea to the new way of importing env variables, outside of that everything looks good.

alexvdvalk commented 1 year ago

I've cleaned up the environment variables setup so that it uses Sveltekits native management. Also updated the readme and dotenv dependency.

emilyf commented 1 year ago

This has been super helpful. I'm still running through this upgrade on my end, but a couple of things:

alexvdvalk commented 1 year ago

Thanks for your comment. I have replaced the SECRET_DIRECTUS_URL with PUBLIC_DIRECTUS_URL in the .env.example file. I also moved the client.js into a server folder as explained at https://kit.svelte.dev/docs/server-only-modules

I don't think hooks are requiered in this demo.

emilyf commented 1 year ago

For what it's worth, this is looking and running great on my end! Looking forward to the merge.