Add /api Pages Functions: now, now/{unit}, from, to

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-19 21:46:00 +00:00
co-authored by Claude Opus 5.5
parent 5ea7101499
commit 6040e3c2a5
6 changed files with 89 additions and 3 deletions
+20 -2
View File
@@ -4,10 +4,28 @@ Live **PRT (Planet Renox Time)**, milliseconds since `1998-03-14T03:00:00.000Z`,
Also on the page: PRT day/week progress, upcoming round-number milestones, next equinox/solstice, a subsolar marker with hover readout (lat/lon, sun altitude, solar time), and a Date ⇄ PRT converter.
Static site, no build step. `ortus` loads from jsDelivr via an import map. Land dots come from Natural Earth 50m land, rasterized to a half-degree RLE mask in `land.js`.
## API
Cloudflare Pages Functions in `functions/api/`, built on `ortus`. JSON responses carry every unit plus `unixMs` and `iso`; CORS is open.
| | |
|---|---|
| `GET /api` | Epoch, units, endpoint list |
| `GET /api/now` | Current PRT in every unit |
| `GET /api/now/{unit}` | Current PRT in one unit, plain text |
| `GET /api/from/{iso\|unixMs}` | PRT at a date, e.g. `/api/from/2010-06-01` |
| `GET /api/to/{n}/{unit?}` | Date at a PRT value, e.g. `/api/to/11111/d` |
```sh
python3 -m http.server # then open http://localhost:8000
curl https://time.planetrenox.com/api/now/d # 10446
```
## Site
Static page, no build step. `ortus` loads from jsDelivr via an import map. Land dots come from Natural Earth 50m land, rasterized to a half-degree RLE mask in `land.js`.
```sh
npm i && npm run dev # wrangler pages dev, serves the site and /api
```
Cloudflare Pages: no build command, output directory `/`.