remove hard coded routes

This commit is contained in:
Devin Zuczek
2026-06-29 22:41:17 -04:00
parent 69b89e2dc4
commit 81815ef06c
29 changed files with 122 additions and 256 deletions
+6 -5
View File
@@ -3,15 +3,16 @@ import { useWorkersLogger } from 'workers-tagged-logger'
import { withNotFound, withOnError } from '@repo/hono-helpers'
import endpoints from '../static/endpoints.json'
import { buildEndpoints } from './endpoints'
import type { App } from './context'
/**
* Name-server / service-discovery worker served at the apex domain.
* Returns the endpoints document the game client fetches to discover every
* service host. Generated from `env.json` by `runx sync` — run it after
* changing the domain (see `apps/ns/static/endpoints.json`).
* service host. Hosts are derived from the `DOMAIN` var, which is injected at
* deploy time (see `run-wrangler-deploy`) and defaults in `wrangler.jsonc` for
* local dev.
*/
const app = new Hono<App>()
.use(
@@ -27,7 +28,7 @@ const app = new Hono<App>()
.onError(withOnError())
.notFound(withNotFound())
// Endpoints document. TODO: generate this dynamically per environment.
.get('/', (c) => c.json(endpoints))
// Endpoints document, derived from the deploy-time base domain.
.get('/', (c) => c.json(buildEndpoints(c.env.DOMAIN)))
export default app