How gvlax/memory-card-game-backend works
This is a REST backend for a memory-card game. A client request reaches the HTTP server and Express app, then the versioned router dispatches card requests to a forwarding controller or score requests to handlers that read or create score records. Score operations pass through a small DB API to a NeDB file store; card requests are proxied to an external cards API. Startup connects the datastore before starting the server. The README documents the REST backend but gives no further behavior details; edges reflect the shown calls and routing.
Main entry points: router.js Versioned router · web-server.js HTTP server · datastore.js Datastore · index.js Startup orchestration
Components 11
Server runtime
- HTTP server
bin/web-server.js - Express app
app.js - Startup orchestration
index.js
API handling
- Versioned router
services/router.js - Cards proxy
controllers/cards.js - Score handlers
controllers/scores.js
Score storage
- Scores DB API
dbapi/scores.js - Datastore
services/datastore.js - Scores file
scores.db
External systems
- Cards API
Other components
- API client
Connections 11
- API client → HTTP server: sends HTTP
bin/web-server.js - HTTP server → Express app: serves requests
bin/web-server.js - Express app → Versioned router: mounts routes
app.js - Versioned router → Cards proxy: routes cards
services/router.js - Versioned router → Score handlers: routes scores
services/router.js - Cards proxy → Cards API: forwards request
controllers/cards.js - Score handlers → Scores DB API: reads or creates
controllers/scores.js - Scores DB API → Datastore: delegates operations
dbapi/scores.js - Datastore → Scores file: reads and writes
services/datastore.js - Startup orchestration → Datastore: connects first
index.js - Startup orchestration → HTTP server: starts server
index.js