add http-server part 5.11
This commit is contained in:
parent
5b3d20a8a5
commit
1e04e6a295
2 changed files with 10 additions and 7 deletions
7
event.ts
7
event.ts
|
@ -1,11 +1,14 @@
|
||||||
import { executeCommand } from './broker.js';
|
//import { executeCommand } from './broker.js';
|
||||||
|
|
||||||
function handleClick(): void {
|
function handleClick(): void {
|
||||||
console.log("Der Button wurde geklickt!");
|
console.log("Der Button wurde geklickt!");
|
||||||
alert("Hallo von TypeScript!");
|
alert("Hallo von TypeScript!");
|
||||||
|
|
||||||
//executeCommand();
|
//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(res => res.text())
|
||||||
.then(text => console.log("Server sagt:", text));
|
.then(text => console.log("Server sagt:", text));
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,13 +3,13 @@ import express from 'express';
|
||||||
import { executeCommand } from './broker';
|
import { executeCommand } from './broker';
|
||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
const port = 8080;
|
const port = 8090;
|
||||||
|
|
||||||
app.post('/api/command', (req, res) => {
|
app.post('/api/command', (req, res) => {
|
||||||
executeCommand();
|
executeCommand();
|
||||||
res.status(200).send('Command executed');
|
res.status(200).send('Command executed');
|
||||||
});
|
});
|
||||||
|
|
||||||
app.listen(port, () => {
|
app.listen(port, '0.0.0.0', () => {
|
||||||
console.log(`Server läuft auf http://localhost:${port}`);
|
console.log(`Server läuft auf http://0.0.0.0:${port}`);
|
||||||
});
|
});
|
Loading…
Reference in a new issue