Neue Version
This commit is contained in:
parent
ac5070d059
commit
49820a3665
@ -1,20 +1,15 @@
|
||||
version: '3.8'
|
||||
|
||||
version: "3.9"
|
||||
services:
|
||||
backend:
|
||||
build:
|
||||
context: ./backend
|
||||
container_name: schiri-backend
|
||||
ports:
|
||||
- "3000:3000"
|
||||
restart: unless-stopped
|
||||
|
||||
frontend:
|
||||
build:
|
||||
context: ./frontend
|
||||
container_name: schiri-frontend
|
||||
build: ./frontend
|
||||
container_name: frontend
|
||||
ports:
|
||||
- "5001:80"
|
||||
restart: unless-stopped
|
||||
- "5001:80"
|
||||
depends_on:
|
||||
- backend
|
||||
|
||||
backend:
|
||||
build: ./backend
|
||||
container_name: backend
|
||||
expose:
|
||||
- "3000"
|
||||
|
||||
@ -5,21 +5,25 @@ server {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
# App-Route
|
||||
location / {
|
||||
try_files $uri /index.html;
|
||||
}
|
||||
|
||||
# API → Intern weiterleiten an Express
|
||||
location /api/ {
|
||||
proxy_pass http://backend:3000/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection keep-alive;
|
||||
proxy_set_header Host $host;
|
||||
proxy_cache_bypass $http_upgrade;
|
||||
}
|
||||
|
||||
# Static Files
|
||||
location ~* \.(?:ico|css|js|gif|jpe?g|png|woff2?|ttf|svg|eot|otf)$ {
|
||||
expires 6M;
|
||||
access_log off;
|
||||
add_header Cache-Control "public";
|
||||
}
|
||||
|
||||
location /api/ {
|
||||
proxy_pass http://backend:3000;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -12,10 +12,6 @@ export default function QuizPage({ mode, onBack, customQuestions }) {
|
||||
const [answerStatus, setAnswerStatus] = useState([]); // "correct" | "wrong" | undefined
|
||||
|
||||
|
||||
//API BAse
|
||||
const API_BASE = "https://api.schiri.marc-wieland.de"; // oder dein Backend-Service
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
const savedQuestions = sessionStorage.getItem("quiz_questions");
|
||||
const savedIndex = sessionStorage.getItem("quiz_current_idx");
|
||||
@ -23,6 +19,8 @@ useEffect(() => {
|
||||
const savedWrong = sessionStorage.getItem("quiz_wrong_questions");
|
||||
const savedStatus = sessionStorage.getItem("quiz_answer_status");
|
||||
|
||||
|
||||
|
||||
if (savedQuestions) {
|
||||
setQuestions(JSON.parse(savedQuestions));
|
||||
setCurrentIdx(parseInt(savedIndex) || 0);
|
||||
@ -36,7 +34,7 @@ useEffect(() => {
|
||||
setQuestions(customQuestions);
|
||||
sessionStorage.setItem("quiz_questions", JSON.stringify(customQuestions));
|
||||
} else {
|
||||
fetch(`${API_BASE}/api/questions/${mode}`)
|
||||
fetch(`/api/questions/${mode}`)
|
||||
.then((res) => res.json())
|
||||
.then((data) => {
|
||||
const shuffled = data.sort(() => 0.5 - Math.random()).slice(0, 30);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user