How aleksandrsherehkov/snake-backend works
Project type and purpose
• This is a single‐service, backend REST API (“Score API”) written in Node.js/Express with TypeScript.
• It exposes CRUD endpoints for game scores, validates input, logs requests, secures HTTP headers, and persists data in a relational database via Prisma.
File structure
• Top-level: configuration (.env.example, tsconfig.json, package.json), database schema/migrations (prisma/), Swagger spec (swagger.json), source code (src/).
• Under src/:
• controllers: HTTP handlers (ping.controller.ts, score.controller.ts)
• routes: Express routers (score.routes.ts)
• services: business logic (ping.service.ts, score.service.ts)
• middlewares: logging, error handling, validation
• validations: Joi schemas
• utils: shared helper classes (HttpError, logger, tryCatch)
• index.ts: app initialization, middleware wiring, server start
README for additional insights
• Confirms tech stack: Express, TypeScript, Prisma, Joi, Helmet, Morgan, Winston, CORS, Swagger-UI.
• Describes endpoints (/api/scores, /api/check-unique-name, /api/ping).
• Shows database migration steps and usage.