Statur Route dazu (server.js)

This commit is contained in:
rxf
2026-03-17 09:03:04 +01:00
parent 4f3f9f842c
commit 99678ae1be
3 changed files with 11 additions and 62 deletions

View File

@@ -1,3 +0,0 @@
# Environment variables for Docker Compose
MONGO_ROOT_USER=root
MONGO_ROOT_PASSWD=SFluorit

View File

@@ -1,59 +0,0 @@
services:
mongodb:
image: mongo:latest
container_name: mongodb
restart: unless-stopped
ports:
- "27017:27017"
environment:
MONGO_INITDB_ROOT_USERNAME: ${MONGO_ROOT_USER}
MONGO_INITDB_ROOT_PASSWORD: ${MONGO_ROOT_PASSWD}
volumes:
- mongodb_data:/data/db
- mongodb_config:/data/configdb
networks:
- app-network
backend:
build:
context: .
dockerfile: Dockerfile
container_name: backend
restart: unless-stopped
ports:
- "3001:3001"
environment:
- PORT=3001
- MONGO_URI=mongodb://${MONGO_ROOT_USER}:${MONGO_ROOT_PASSWD}@mongodb:27017/appointmentsdb?authSource=admin
depends_on:
- mongodb
volumes:
- ./src:/app/src
- ./package.json:/app/package.json
networks:
- app-network
frontend:
build:
context: ../frontend
dockerfile: Dockerfile
container_name: frontend
restart: unless-stopped
ports:
- "5173:5173"
depends_on:
- backend
volumes:
- ../frontend/src:/app/src
- ../frontend/package.json:/app/package.json
networks:
- app-network
volumes:
mongodb_data:
mongodb_config:
networks:
app-network:
driver: bridge

View File

@@ -30,6 +30,17 @@ app.use(express.json());
// API ROUTEN // API ROUTEN
// ----------------------------------------------------- // -----------------------------------------------------
// Root-Route zur Status-Überprüfung
app.get('/', (req, res) => {
res.json({
message: 'Appointment API Server läuft',
status: 'ok',
endpoints: {
appointments: '/api/appointments'
}
});
});
// 1. READ: Alle Termine abrufen (GET /api/appointments) // 1. READ: Alle Termine abrufen (GET /api/appointments)
app.get('/api/appointments', async (req, res) => { app.get('/api/appointments', async (req, res) => {
try { try {