iching-broker-level2/backend/server.ts
Christopher Hase 36cdaea265
All checks were successful
ci / build (push) Successful in 1m9s
add http-server part 7.9.3 CORS
2025-04-11 12:23:48 +02:00

22 lines
No EOL
451 B
TypeScript

import express from 'express';
import cors from 'cors';
import { executeCommand } from './broker.js';
const app = express();
const port = 8090;
//CORS aktivieren
app.use(cors());
/*app.use(cors({
origin: 'http://localhost:8080'
}));*/
app.post('/api/command', (req, res) => {
executeCommand();
res.status(200).send('Command executed');
});
app.listen(port, '0.0.0.0', () => {
console.log(`Server läuft auf http://0.0.0.0:${port}`);
});