Can I host static .json files on Pages? I want to upload them via REST


e.g I have a cloud function that runs 1x per day and gets the top 10 news of the day from a source. I now create a .json object with these 10 news, and now instead of uploading it to Google Cloud Storage, I want to upload them to Cloudflare Pages (via REST).

Is that possible?

Would be possible with a custom CF worker, but pages itself only builds from Git for now.

1 Like

thanks buddy! but how with a cf worker?

worker sites ain’t a solution i think… there’s only this wrangler stuff,and%20React%20Open%20external%20link.

Workers sites would also work, they just don’t provide a REST api. You could create a rest api with workers that takes in a file via POST and uploads it to a KV namespace, which is later accessible by workers sites or your own KV serving code.

Some example code is here:

But you will need to look into workers documentation and examples and code the worker if you want this specific rest API. Cf does not provide it natively.

1 Like