iching-broker-level2/backend/server.ts

21 lines
529 B
TypeScript
Raw Normal View History

2025-04-09 13:47:06 +00:00
import express from 'express';
2025-04-11 09:30:53 +00:00
import cors from 'cors';
2025-04-10 13:57:16 +00:00
import { executeCommand } from './broker.js';
2025-04-09 13:47:06 +00:00
const app = express();
2025-04-11 09:30:53 +00:00
const port = 8090;
2025-04-09 13:47:06 +00:00
2025-04-11 12:54:42 +00:00
app.use(cors());
2025-04-14 08:32:34 +00:00
2025-04-14 10:03:42 +00:00
app.post('/iching/api/command', (req, res) => {
2025-04-15 14:28:48 +00:00
//TODO no logging from inside this method???
console.log(`Backend-Server: receiving POST to /iching/api/command`);
2025-04-09 13:47:06 +00:00
executeCommand();
2025-04-15 14:28:48 +00:00
res.status(200).send('Backend-Server: Broker was called\n');
2025-04-09 13:47:06 +00:00
});
2025-04-09 14:51:26 +00:00
app.listen(port, '0.0.0.0', () => {
2025-04-15 14:28:48 +00:00
console.log(`Backend-Server running on http://0.0.0.0:${port}`);
2025-04-14 09:24:56 +00:00
});