Cloudflare Worker that fetches the Ole Miss football schedule from ESPN and returns a slim JSON payload sized for a Garmin Connect IQ watch face.
ESPN's team-schedule response is ~400 KB. Connect IQ's Communications
module enforces a ~32 KB cap on JSON responses to watch-face background
services, so the watch can't ingest the upstream payload directly. This
worker strips each event down to the five fields the watch face actually
uses and returns ~1–2 KB.
{
"events": [
{
"opponent": "Alabama",
"kickoffSec": 1762113600,
"confirmed": true,
"status": "STATUS_SCHEDULED",
"home": false
}
]
}| Field | Notes |
|---|---|
opponent |
Prefers shortDisplayName → location → displayName → "TBD". |
kickoffSec |
Unix seconds (UTC). Watch hydrates this into a Time.Moment. |
confirmed |
false when ESPN's status detail contains "TBD" (kickoff time set). |
status |
ESPN status name, e.g. STATUS_SCHEDULED, STATUS_FINAL. |
home |
true if Ole Miss is the home competitor. |
GET /— current season's schedule.GET /?season=2025— specific season. Useful out-of-season; the watch leaves this off so it always tracks the current year.
Non-GET methods return 405. Upstream errors return 502 with a JSON
{ error, detail } body.
Two layers, both keyed on the upstream URL (so ?season=YYYY and the default
endpoint don't collide):
- Cloudflare edge cache via
fetch(..., { cf: { cacheTtl, cacheEverything } })on the upstream call. - Workers Cache API (
caches.default) on the slimmed response.
Both use a 5-minute TTL. The watch face polls every 15 minutes during its live window, so this keeps ESPN traffic well under the Workers free-tier budget (100k requests/day).
npm install
npm run dev # wrangler dev — local worker on :8787
npm run deploy # wrangler deploy
npm run tail # stream production logsRequires a Cloudflare account configured via wrangler login. Observability
is enabled in wrangler.toml, so logs and request analytics show up in the
Cloudflare dashboard automatically.
src/index.ts # worker entrypoint + ESPN payload parser
wrangler.toml # worker config (compat date, observability)
tsconfig.json # strict TS, Workers types