Pages + Workers | /functions folder with SvelteKit is not working
I'm developing an app using SvelteKit and I'm deploying it via github -> cloudflare pages. I have a /functions folder at the root of my project but cloudflare does not seem to be picking it up. I tried adding a postbuild script in my package to try and move functions into the output but that didn't work.
My function is at /functions/api-submit-resource.js (originally was /functions/api/submit-resource). It had an
export Default { async fetch() }
export Default { async fetch() }
method but I tried
export async function onRequestPost(context)
export async function onRequestPost(context)
since it wasn't working.
I'm not really sure where to put my functions folder since Cloudflare isn't picking up the folder and I can't move it into the svelte output folder since cloudflare will be building it on their server. What should I do? At the current I have a worker function and a pages worker, on different domains (api is on <mysite>.<me>.workers.dev and the svelte app is on <mysite>.pages.dev), which technically works, but I'd rather it all be on one project.