- Created package.json for managing workspaces (frontend and backend) - Added scripts for development, build, testing, and Docker operations - Implemented kill-dev-processes.sh script to terminate development processes gracefully
51 lines
1.3 KiB
TypeScript
51 lines
1.3 KiB
TypeScript
import express from "express";
|
|
import cors from "cors";
|
|
|
|
const app = express();
|
|
const PORT = process.env.PORT || 3001;
|
|
|
|
// Middleware
|
|
app.use(cors());
|
|
app.use(express.json());
|
|
|
|
// Routes
|
|
app.get("/api/health", (req, res) => {
|
|
// 🐛 Breakpoint-Test: Setze hier einen Breakpoint zum Testen
|
|
console.log("Health check aufgerufen!");
|
|
|
|
res.json({
|
|
status: "OK",
|
|
message: "Backend is running",
|
|
timestamp: new Date().toISOString(),
|
|
});
|
|
});
|
|
|
|
app.get("/api/photos", (req, res) => {
|
|
// Beispiel-Endpunkt für Fotos
|
|
res.json({
|
|
photos: [
|
|
{ id: 1, name: "photo1.jpg", url: "/images/photo1.jpg" },
|
|
{ id: 2, name: "photo2.jpg", url: "/images/photo2.jpg" },
|
|
],
|
|
});
|
|
});
|
|
|
|
app.post("/api/print", (req, res) => {
|
|
// Beispiel-Endpunkt für Druckaufträge
|
|
const { photoId, copies } = req.body;
|
|
|
|
console.log(`Druckauftrag erhalten: Photo ID ${photoId}, Kopien: ${copies}`);
|
|
|
|
res.json({
|
|
success: true,
|
|
message: `Druckauftrag für Photo ${photoId} mit ${copies} Kopien wurde erstellt`,
|
|
jobId: Math.random().toString(36).substr(2, 9),
|
|
});
|
|
});
|
|
|
|
app.listen(PORT, () => {
|
|
console.log(`🚀 Backend Server läuft auf Port ${PORT}`);
|
|
console.log(`📍 Health Check: http://localhost:${PORT}/api/health`);
|
|
console.log(`🐛 Debugger bereit auf Port 9229`);
|
|
});
|