fetch('/api/endpoint.json')fetch('/api/helloworld'). i get a 404. however i can reach it fine when running locally with wranglerfetch it from my webpage: fetch('/api/helloworld')

/:path and routing all requests through it - this likely is taking priority over your own functioncurl some endpoint after your build script runs in pages ci. Not perfect, but might be good enough?

/project
/src
/pages
/api
/endpoint.json.ts/project
/functions
/api
/helloworld.ts
/src
/pages
/endpoint.json.ts/root-project
/functions
/api
helloworld.tspnpm create astro@latest # choose basic site, accept defaults
cd yourproject
pnpm run astro add cloudflare
# open astro.config.js and modify adapter line to look like this:
# adapter: cloudflare({mode: "directory"})
mkdir functions
touch functions/hello.js
# add code to hello.js
# add code to a src/pages/index.astro to call to hello function.
# maybe add a button so when you click it calls fetch('/hello')
# run project locally:
wrangler pages dev -- npm run dev
# click button and you will see the function is called successfully
# now push your project up to github. and connect cloudflare to github repo, deploy it.
# you will see that you get a 404 when it tries to fetch('/hello')