add http-server part 5.11

This commit is contained in:
Christopher Hase 2025-04-09 16:51:26 +02:00
parent 5b3d20a8a5
commit 1e04e6a295
2 changed files with 10 additions and 7 deletions

View file

@ -1,11 +1,14 @@
import { executeCommand } from './broker.js';
//import { executeCommand } from './broker.js';
function handleClick(): void {
console.log("Der Button wurde geklickt!");
alert("Hallo von TypeScript!");
//executeCommand();
fetch("/api/command", { method: "POST" })
/*fetch("/api/command", { method: "POST" })
.then(res => res.text())
.then(text => console.log("Server sagt:", text));*/
fetch("https://192-168-197-2.c-one-infra.de/api/command", { method: "POST" })
.then(res => res.text())
.then(text => console.log("Server sagt:", text));
}

View file

@ -3,13 +3,13 @@ import express from 'express';
import { executeCommand } from './broker';
const app = express();
const port = 8080;
const port = 8090;
app.post('/api/command', (req, res) => {
executeCommand();
res.status(200).send('Command executed');
});
app.listen(port, () => {
console.log(`Server läuft auf http://localhost:${port}`);
});
app.listen(port, '0.0.0.0', () => {
console.log(`Server läuft auf http://0.0.0.0:${port}`);
});