2026-11-29
The data stays on your server, in a small database file that the app owns. The static page runs on Cloudflare Pages or another static host, and it calls the app over HTTPS. The page reads the data and sends new rows back. Our test used a Python app with a SQLite file on the panel.
The app
- GET /data.json returns the latest rows as JSON, with the header Access-Control-Allow-Origin: *.
- POST /visit accepts a JSON body with a note and inserts a row. It answers 201 with the new id.
- The database file data.db sits in the app folder. A new package deploy for the same account replaces that folder, so copy data.db before you redeploy.
Test it
- curl -sS https://your-app-domain/data.json returns 200 with the JSON and the CORS header.
- Send a POST with a JSON file as the body and Content-Type application/json. Use a file: some shells strip the quotes from an inline body. The answer is 201.
- From the static page's own origin, fetch the JSON. With the CORS header the browser allows the request.
Our result
Through the Cloudflare proxy, the read returned 200 with the header, and the write returned 201 with saved id 1. The next read showed the row. The test ran on one app with one database file.
Security
A write endpoint that anyone can call can be abused, and the static page source is public. Do not put a write secret in the page. For writes, put a small Cloudflare Pages Function or Worker in front of the app and keep the secret in its settings. Read-only JSON can stay public.
