Add Node.js/Express API service to Docker Compose #1
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Goal
Add a lightweight backend alongside the existing nginx container so the booking form has somewhere to POST data.
Tasks
api/directory with Express + SQLite appapi/server.js— base Express setup with health check atGET /api/healthapi/db.js— SQLite init withbookingstable schemaapi/package.json— dependencies: express, better-sqlite3, cors, dotenvapi/Dockerfile— Node 20 Alpine imagedocker-compose.ymlto addapiservice on port 3001nginx.confto proxy/api/→http://api:3001/Bookings table schema
Acceptance
docker compose upstarts both nginx and api containersGET /api/healthreturns{"ok":true}POST /api/bookingsstores a booking and returns the new id