Cybersecurity-Projects/PROJECTS/beginner/canary-token-generator/frontend
CarterPerez-dev 915d471b8d fix(canary): vite dev proxy — correct backend port + stop stripping /api
Two latent template-leftover bugs in vite.config.ts proxy that 404'd every
useTokenTypes/useCreateToken/useManageToken/useDeleteToken call:

- Default target was http://localhost:8000. Backend listens on :8080
  (backend/config.yaml `server.port: 8080`, default registered in
  internal/config/config.go). Off-by-one-port silent for the whole
  Phase 14 cycle because Phase 14 didn't end-to-end-test.

- `rewrite: (p) => p.replace(/^\/api/, '')` stripped /api before forwarding.
  But backend mounts routes UNDER /api via `r.Route("/api", ...)`
  (cmd/canary/main.go:322). So a request for /api/tokens/types got rewritten
  to /tokens/types, which backend doesn't serve — 404 page not found.

Frontend axios uses baseURL `/api` and path `/tokens/types` → full URL
`/api/tokens/types`. With these fixes the proxy now passes that through
verbatim to http://localhost:8080/api/tokens/types, which is where chi
actually mounts the route.

dev.compose.yml: added VITE_API_TARGET=http://canary:8080 to the frontend
container's env so the dev-compose path also works (inside the container
"localhost" is the vite container, not the canary container — has to use
docker DNS).

Surfaced today when the operator manually eyeballed the landing page and
SpeciesSection rendered "Could not load species catalog. Try again in a
moment." (the descriptorsError branch in landing/index.tsx SpeciesSection).
2026-05-17 17:37:36 -04:00
..
public/asset feat(canary): import operator's React + Vite frontend template 2026-05-10 05:28:09 -04:00
src feat(canary): web fonts — Archivo Black / Space Grotesk / Departure Mono 2026-05-17 17:27:35 -04:00
.dockerignore feat(canary): import operator's React + Vite frontend template 2026-05-10 05:28:09 -04:00
.gitignore feat(canary): import operator's React + Vite frontend template 2026-05-10 05:28:09 -04:00
.stylelintignore fix(canary-phase1): clear all post-phase-1 audit observations + header normalization 2026-05-10 06:15:26 -04:00
biome.json feat(canary): import operator's React + Vite frontend template 2026-05-10 05:28:09 -04:00
index.html feat(canary): web fonts — Archivo Black / Space Grotesk / Departure Mono 2026-05-17 17:27:35 -04:00
package.json feat(canary): import operator's React + Vite frontend template 2026-05-10 05:28:09 -04:00
pnpm-lock.yaml feat(canary): import operator's React + Vite frontend template 2026-05-10 05:28:09 -04:00
stylelint.config.js fix(canary-phase1): clear all post-phase-1 audit observations + header normalization 2026-05-10 06:15:26 -04:00
tsconfig.app.json feat(canary): import operator's React + Vite frontend template 2026-05-10 05:28:09 -04:00
tsconfig.json feat(canary): import operator's React + Vite frontend template 2026-05-10 05:28:09 -04:00
tsconfig.node.json feat(canary): import operator's React + Vite frontend template 2026-05-10 05:28:09 -04:00
vite.config.ts fix(canary): vite dev proxy — correct backend port + stop stripping /api 2026-05-17 17:37:36 -04:00