add http-server part 8.4, improve html

This commit is contained in:
Christopher Hase 2025-04-14 12:44:59 +02:00
parent 6c4094c27c
commit 2cf73e1cb2
5 changed files with 62 additions and 77 deletions

View file

@ -31,7 +31,7 @@ When a pod with the app is initally started, one email will be sent to the confi
The backend server is running inside the pod on the address http://localhost:8090/command. If a POST is sent to this address, the server will run the main logic of this app:
An E-Mail with an I-Ching horoscope (provided by the library app) will be sent to the configured email address.
The backend server can be tested from inside the pod by calling 'curl -X POST http://localhost:8090/command' from the console.
The backend server can be tested from inside the pod by calling 'curl -X POST http://localhost:8090/iching/api/command' from the console.
## HTTP Server

View file

@ -7,8 +7,6 @@ const port = 8090;
app.use(cors());
//app.post('/api/command', (req, res) => {
app.post('/iching/api/command', (req, res) => {
executeCommand();
res.status(200).send('Command executed\n');

View file

@ -1,12 +1,64 @@
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="UTF-8">
<title>Button mit TypeScript</title>
</head>
<body>
<h1>Mein Button</h1>
<button id="myButton">Klick mich!</button>
<script type="module" src="./event.mjs"></script>
</body>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Your I-Ging Horoscope</title>
<style>
body {
margin: 0;
padding: 0;
background: linear-gradient(to bottom right, #fdf6e3, #e3f2fd);
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.container {
text-align: center;
background: white;
padding: 2rem;
border-radius: 1rem;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}
h1 {
margin-bottom: 1rem;
color: #3f51b5;
}
#myButton {
background-color: #3f51b5;
color: white;
border: none;
padding: 0.8rem 1.5rem;
font-size: 1.1rem;
border-radius: 0.5rem;
cursor: pointer;
transition: background-color 0.3s ease;
}
#myButton:hover {
background-color: #303f9f;
}
.footer {
margin-top: 2rem;
font-size: 0.9rem;
color: #666;
}
</style>
</head>
<body>
<div class="container">
<h1>🧘 My I-Ging Horoscope</h1>
<p>Click on the Button to receive your personal Horoscope. 100% accuracy guaranteed!</p>
<button id="myButton">✨ Receive Horoscope ✨</button>
<div class="footer">With Love & Chance from the Cosmos 💫</div>
</div>
<script type="module" src="./event.mjs"></script>
</body>
</html>

View file

@ -1,34 +0,0 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: iching-ingress
namespace: argocd
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /$2
spec:
ingressClassName: nginx
rules:
- host: 192-168-197-2.c-one-infra.de
http:
paths:
# API → kein Rewrite
- path: /iching/api(/|$)(.*)
pathType: ImplementationSpecific
backend:
service:
name: iching-service
port:
number: 81
# Frontend → mit Rewrite
- path: /iching(/|$)(.*)
pathType: ImplementationSpecific
backend:
service:
name: iching-service
port:
number: 80
tls:
- hosts:
- 192-168-197-2.c-one-infra.de
secretName: argocd-net-tls

View file

@ -1,31 +0,0 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: iching-ingress
namespace: argocd
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /$2
spec:
ingressClassName: nginx
rules:
- host: 192-168-197-2.c-one-infra.de
http:
paths:
- path: /iching/api(/|$)(.*)
pathType: ImplementationSpecific
backend:
service:
name: iching-service
port:
number: 81
- path: /iching(/|$)(.*)
pathType: ImplementationSpecific
backend:
service:
name: iching-service
port:
number: 80
tls:
- hosts:
- 192-168-197-2.c-one-infra.de
secretName: argocd-net-tls