Files
builazoo/server
ncantu c7d389ecbb Lint: fix errors and remove unused variables
**Motivations:**
- Ensure lint config is not degraded and fix all lint errors for pousse workflow.

**Root causes:**
- Unused variables kept with _ prefix instead of removed (_row, _questReward, _i).
- getAnimalBlockOrigin had 5 parameters (max 4).
- use of continue statement (no-continue rule).

**Correctifs:**
- ESLint config verified; no eslint-disable in codebase.
- Removed unused variable _row (biome-rules); removed dead function _questReward (quests); removed unused map param _i (state.js).
- getAnimalBlockOrigin refactored to 4 params (pos object instead of x, y).
- Replaced continue with if (cell) block in normalizeLoadedCells (state.js).
- JSDoc param names aligned with _height, _y (biome-rules).

**Evolutions:**
- (none)

**Pages affectées:**
- web/js/biome-rules.js
- web/js/quests.js
- web/js/state.js
- web/js/placement.js
2026-03-04 15:32:27 +01:00
..
2026-03-03 22:24:17 +01:00
2026-03-03 22:24:17 +01:00
2026-03-03 22:24:17 +01:00
2026-03-03 22:24:17 +01:00
2026-03-03 22:24:17 +01:00
2026-03-03 22:24:17 +01:00
2026-03-03 22:24:17 +01:00
2026-03-03 22:24:17 +01:00
2026-03-03 22:24:17 +01:00
2026-03-03 22:24:17 +01:00

Build a Zoo — API server

Node + Express + PostgreSQL. Auth by Ed25519 keypair (pseudo, no password). Zoos and game state persisted in DB; bots ensure minimum zoo density on the map.

Prerequisites

  • Node 18+
  • PostgreSQL (create a database, e.g. builazoo)

Setup

npm install
createdb builazoo   # or your DB name
psql -d builazoo -f schema.sql

Set environment:

  • DATABASE_URL: connection string (default postgres://localhost/builazoo)
  • PORT: HTTP port (default 3000)

Run

npm start

API base URL is http://localhost:3000 (or your host/port). From the web client, set window.BUILAZOO_API_URL to this URL before loading the app (e.g. in HTML or via build env) to enable sign-up and sync. For local testing you can also open the web app with ?api=http://localhost:3000 (or your API origin).

Endpoints

  • GET /api/health — health check
  • POST /api/auth/register — create account (body: { pseudo }, header: X-Public-Key base64url)
  • GET /api/zoos — list zoos for map (creates bots if below minZoos)
  • GET /api/zoos/me — get my zoo + game_state (signed)
  • POST /api/zoos/me — create my zoo (signed, body: { name?, game_state })
  • PATCH /api/zoos/me — update game_state (signed, body: { game_state })

Signed requests use headers: X-Public-Key, X-Signature, X-Timestamp. Message signed = method + path + timestamp + SHA256(body).