First commit

This commit is contained in:
MarcWieland
2025-07-25 01:24:32 +02:00
commit 51ce615f1d
655 changed files with 86346 additions and 0 deletions

BIN
backend/.DS_Store vendored Normal file

Binary file not shown.

8
backend/Dockerfile Normal file
View File

@@ -0,0 +1,8 @@
FROM node:18
WORKDIR /app
COPY . .
RUN npm install
EXPOSE 3000
CMD ["node", "server.js"]

5634
backend/c_condensed.json Normal file

File diff suppressed because it is too large Load Diff

6529
backend/d_condensed.json Executable file

File diff suppressed because it is too large Load Diff

18
backend/package.json Normal file
View File

@@ -0,0 +1,18 @@
{
"name": "trainer2",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"type": "commonjs",
"dependencies": {
"cookie-parser": "^1.4.7",
"cors": "^2.8.5",
"express": "^5.1.0"
}
}

32
backend/server.js Normal file
View File

@@ -0,0 +1,32 @@
const express = require("express");
const fs = require("fs");
const path = require("path");
const cors = require("cors");
const cookieParser = require("cookie-parser");
const app = express();
const PORT = 3000;
//app.use(cors({ origin: "https://schiri.marc-wieland.de", credentials: true }));
app.use(cookieParser());
app.use(express.json());
app.get("/api/questions/:mode", (req, res) => {
const mode = req.params.mode?.toLowerCase();
if (!["d", "c"].includes(mode)) {
return res.status(400).json({ error: "Ungültiger Modus. Nur 'd' oder 'c' erlaubt." });
}
const filePath = path.join(__dirname, `${mode}_condensed.json`);
try {
const data = fs.readFileSync(filePath, "utf8");
res.json(JSON.parse(data));
} catch (err) {
res.status(500).json({ error: "Fehler beim Laden der Fragen." });
}
});
app.listen(PORT, () => {
console.log(`📡 Backend läuft auf http://localhost:${PORT}`);
});