// ── This module's own API bindings ──────────────────────────────────────── // // Core hands out the request PRIMITIVE and nothing above it (MODULE_API.md // §3.5): same-origin `/api/v1`, cookies included, JSON in and out, and an // `ApiError` thrown on any non-2xx. The paths are yours, because the routes at // the other end are yours — `server/router/**` in this repo serves them. // // **Do not build your own fetch wrapper.** The primitive is what carries the // session cookie, the CSRF handling and the error shape core's `ErrorState` // knows how to render. A module that calls `fetch` directly gets none of that // and finds out one page at a time. // // Keeping the bindings in one file, ordered the way the routers are, is // convention rather than contract — but the two halves of every call live in // different directories and nothing checks them against each other, so anything // that makes a mismatch easy to see is worth doing. import rg from './core.js' const { request: req, BASE } = rg.api // ── public ──────────────────────────────────────────────────────────────── // Token-free, same-origin reads. Paths are relative to `/api/v1`, so this hits // `/api/v1/public/world/status` — the route `server/router/public/world.router.js` // registers under the `/world` prefix `module.json` declares. export const world = { status: () => req('/public/world/status'), } // Exported for the rare caller that needs the base itself — an ``, a // download link, an EventSource. Reach for `request` first. export { BASE } export default { world, BASE }