I have an order page for which I handle form submission via a POST RequestHandler in a SvelteKit endpoint (code example). This endpoint is, so far, mostly in charge of persisting the submitted data via the Sanity Client API.
Now, I want to dispatch email confirmations (Sendgrid in my case) after the data gets persisted. I'm having a hard time deciding whether I should do that directly in the SvelteKit endpoint, or in a Netlify function.
While answering the original question (in title), please also help me clarify:
- whether
@sveltejs/adapter-netlify
actually runs SvelteKit endpoints using Netlify functions by default (and, if so, why I can't list them withnetlify functions:list
or execute them withnetlify functions:invoke endpoint
) - which scenario might be a better fit for the one or the other
- whether the newer type of Netlify Edge functions specifically fit this use case or not.
Thanks a lot!