add http-server part 6

This commit is contained in:
Christopher Hase 2025-04-10 08:57:08 +02:00
parent 21cbfb31c9
commit c8d6cc124d
3 changed files with 8 additions and 5 deletions

View file

@ -28,4 +28,6 @@ COPY --from=rust-build /usr/local/cargo/bin/iching /usr/local/bin/iching
RUN mkdir -p dist/iching RUN mkdir -p dist/iching
RUN cp dist/*.js dist/iching/ RUN cp dist/*.js dist/iching/
RUN node server.js
CMD ["npx", "http-server", "dist", "-p", "8080", "--mime", "application/javascript=js"] CMD ["npx", "http-server", "dist", "-p", "8080", "--mime", "application/javascript=js"]

View file

@ -3,12 +3,13 @@ function handleClick(): void {
console.log("Der Button wurde geklickt!"); console.log("Der Button wurde geklickt!");
alert("Hallo von TypeScript!"); alert("Hallo von TypeScript!");
/*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));
/*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)); */
} }
document.addEventListener("DOMContentLoaded", () => { document.addEventListener("DOMContentLoaded", () => {