import express from "express"; const app = express(); const responses = { "dog": "images/dog.jpg", "cat": "images/cat.jpg", "car": "images/car.jpg", }; app.use(express.json()); app.post("/generate-image", (req, res) => { let { model } = req.body; if (!model) { return res.status(400).json({ error: "No model provided" }); } if (!responses[model]) { return res.status(400).json({ error: "Invalid model" }); } res.json({ imagePath: responses[model] }); }); app.listen(3000, () => { console.log("API started on port 3000"); });