A Cloudflare Worker that makes a requests to get the sheet info and then cleans it up a bit and returns an array of values.
The default response is JSON. If you'd like CSV just append .csv
at the end of the url. For example https://covidtracking.com/api/states.csv
- States current - /api/states | CSV
lastUpdateEt
is the state’s last data update.checkTimeET
is the last time our people checked. - States daily 4 pm ET - /api/states/daily | CSV
- States info - /api/states/info | CSV
- US current - /api/us | CSV
- US daily - /api/us/daily | CSV
- Counties- /api/counties | CSV
- Tracker URLs - /api/urls
- State Website Screenshots - /api/screenshots
If you want to filter the /api/us/daily
you can add a query param like ?state=NY
to only show cases in New York. Or ?state=NY&date=20200316
to show the result of a specific date.
- Playground - https://covidtracking.com/api/playground
- GraphQL API - https://covidtracking.com/api/graphql
Currently each and every request is passed through Netlify to Cloudflare that makes an API request to Google and then cleans it up and decides format before returning results. A minimal cache is configured.
- Add wrangler.toml file.
- Get a Google API Key https://console.developers.google.com/
- Add Google API Key to cloudflare environment with the command
wrangler secret put GOOGLE_API_KEY
- Publish to Cloudflare with the command
wrangler publish
To deploy using serverless add a serverless.yml
file.
Install cloudflare-worker-local
yarn global add cloudflare-work-local
yarn global add nodemon
wrangler build && cloudflare-worker-local worker/script.js covid.cape.io 3000 wrangler.toml staging
nodemon --watch worker/script.js --signal SIGHUP --exec 'cloudflare-worker-local worker/script.js covid.cape.io 3000'
wrangler kv:key list --binding=COVID --env=staging
wrangler kv:key list --binding=COVID --env=production --prefix="/states.json"
wrangler kv:key delete --binding=COVID --env=staging "/screenshots"
wrangler kv:key delete --binding=COVID --env=production "/press"