first commit
This commit is contained in:
50
server.js
Normal file
50
server.js
Normal file
@@ -0,0 +1,50 @@
|
||||
const express = require('express');
|
||||
const cors = require('cors');
|
||||
|
||||
const app = express();
|
||||
const PORT = 3001;
|
||||
|
||||
// Middleware
|
||||
app.use(cors());
|
||||
app.use(express.json());
|
||||
|
||||
// Test-Endpoint zum Prüfen
|
||||
app.get('/', (req, res) => {
|
||||
res.send('✅ AI Design Assistant Server läuft!');
|
||||
});
|
||||
|
||||
// Hier kommt der AI-Mock-Endpoint
|
||||
app.post('/api/generate-design', (req, res) => {
|
||||
const { prompt } = req.body;
|
||||
|
||||
console.log('📝 Prompt erhalten:', prompt);
|
||||
|
||||
// Beispiel-Ausgabe (hier könntest du später KI-Logik einbauen)
|
||||
const result = {
|
||||
elements: [
|
||||
{
|
||||
type: 'rectangle',
|
||||
x: 100,
|
||||
y: 100,
|
||||
width: 200,
|
||||
height: 150,
|
||||
color: { r: 0.3, g: 0.6, b: 0.9 }
|
||||
},
|
||||
{
|
||||
type: 'rectangle',
|
||||
x: 350,
|
||||
y: 200,
|
||||
width: 120,
|
||||
height: 100,
|
||||
color: { r: 0.8, g: 0.4, b: 0.2 }
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
res.json(result);
|
||||
});
|
||||
|
||||
// Starte Server
|
||||
app.listen(PORT, () => {
|
||||
console.log(`🚀 Server läuft auf http://localhost:${PORT}`);
|
||||
});
|
||||
Reference in New Issue
Block a user