Compare commits
13 Commits
Author | SHA1 | Date | |
---|---|---|---|
7868fe0fe0 | |||
4244d03384 | |||
4bb071cbb5 | |||
0fb46cb43f | |||
5188b0e4c0 | |||
a6dedd46ed | |||
772cb944a3 | |||
764ac9c38b | |||
58332ee8fc | |||
78497291a8 | |||
7ef52321d6 | |||
af30e87d96 | |||
725cd7e08a |
@@ -7,6 +7,6 @@ RUN npm install
|
||||
|
||||
COPY . .
|
||||
|
||||
EXPOSE 8002
|
||||
EXPOSE 8502
|
||||
|
||||
CMD ["npm", "start"]
|
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"name": "backend",
|
||||
"version": "1.0.0",
|
||||
"type": "module",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
@@ -18,4 +19,4 @@
|
||||
"jose": "^6.0.12",
|
||||
"mysql2": "^3.14.3"
|
||||
}
|
||||
}
|
||||
}
|
@@ -9,12 +9,11 @@ import {
|
||||
removeEntries,
|
||||
saveRow,
|
||||
resetData,
|
||||
getVitals,
|
||||
} from "./services/database.js";
|
||||
import { generateToken, authenticate } from "./services/tokenService.js";
|
||||
env.config();
|
||||
const app = express();
|
||||
const port = 8002;
|
||||
const port = 8502;
|
||||
|
||||
app.use(cors());
|
||||
// Increase body size limits to support large CSV JSON payloads
|
||||
@@ -35,8 +34,6 @@ app.post("/lose", async (req, res) => {
|
||||
}
|
||||
});
|
||||
|
||||
// !!!!!!! AUTHORISATION HINZUFÜGEN - DENN GEHT NICHT !!!!!!!!
|
||||
|
||||
app.get("/table-data", authenticate, async (req, res) => {
|
||||
const result = await getTableData();
|
||||
if (result.success && result.data) {
|
||||
|
@@ -1,11 +1,12 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Backend</title>
|
||||
</head>
|
||||
<body>
|
||||
Backend
|
||||
</body>
|
||||
</html>
|
||||
</head>
|
||||
<body>
|
||||
<h1>You have reached the backend views index page!</h1>
|
||||
<p>Currently, there is nothing to display!</p>
|
||||
</body>
|
||||
</html>
|
||||
|
@@ -1,21 +1,27 @@
|
||||
services:
|
||||
# mcs_lose-frontend:
|
||||
# container_name: mcs_lose-frontend
|
||||
# build: ./frontend
|
||||
# ports:
|
||||
# - "8001:8001"
|
||||
# environment:
|
||||
# - CHOKIDAR_USEPOLLING=true
|
||||
# volumes:
|
||||
# - ./frontend:/app
|
||||
# - /app/node_modules
|
||||
# restart: unless-stopped
|
||||
mcs_lose-frontend:
|
||||
container_name: mcs_lose-frontend
|
||||
build: ./frontend
|
||||
ports:
|
||||
- "8501:8501"
|
||||
environment:
|
||||
- CHOKIDAR_USEPOLLING=true
|
||||
networks:
|
||||
- proxynet
|
||||
- lose-local
|
||||
volumes:
|
||||
- ./frontend:/app
|
||||
- /app/node_modules
|
||||
restart: unless-stopped
|
||||
|
||||
mcs_lose-backend:
|
||||
container_name: mcs_lose-backend_express
|
||||
build: ./backend
|
||||
ports:
|
||||
- "8002:8002"
|
||||
- "8502:8502"
|
||||
networks:
|
||||
- proxynet
|
||||
- lose-local
|
||||
environment:
|
||||
DB_HOST: mysql
|
||||
DB_USER: root
|
||||
@@ -31,13 +37,21 @@ services:
|
||||
container_name: mcs_lose-mysql
|
||||
image: mysql:8.0
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- lose-local
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: D7Ze0lwV9hMrNQHdz1Q8yi0MIQuOO8
|
||||
MYSQL_DATABASE: mcs_lose
|
||||
volumes:
|
||||
- mysql-data:/var/lib/mysql
|
||||
ports:
|
||||
- "3308:3306"
|
||||
- "8500:3306"
|
||||
|
||||
volumes:
|
||||
mysql-data:
|
||||
|
||||
networks:
|
||||
proxynet:
|
||||
external: true
|
||||
lose-local:
|
||||
external: false
|
||||
|
@@ -7,6 +7,6 @@ RUN npm install
|
||||
|
||||
COPY . .
|
||||
|
||||
EXPOSE 8001
|
||||
EXPOSE 8501
|
||||
|
||||
CMD ["npm", "run", "dev"]
|
@@ -55,7 +55,7 @@ export async function postCSV(file: File): Promise<boolean> {
|
||||
const chunkSize = 2000; // ~2k per request => 25 requests for 50k
|
||||
for (let i = 0; i < lines.length; i += chunkSize) {
|
||||
const chunk = lines.slice(i, i + chunkSize);
|
||||
const res = await fetch("http://localhost:8002/create-entry", {
|
||||
const res = await fetch("https://backend.lose.the1s.de/create-entry", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
|
@@ -20,7 +20,7 @@ export const handleSubmit = async (e: React.FormEvent<HTMLFormElement>) => {
|
||||
|
||||
let response: Response;
|
||||
try {
|
||||
response = await fetch("http://localhost:8002/login", {
|
||||
response = await fetch("https://backend.lose.the1s.de/login", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ username, password }),
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import { myToast } from "./toastify";
|
||||
|
||||
export const registerLos = async (data: any) => {
|
||||
await fetch("http://localhost:8002/lose", {
|
||||
await fetch("https://backend.lose.the1s.de/lose", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
|
@@ -30,7 +30,7 @@ function createHeaders(token: string) {
|
||||
export const removeSelection = (token: string) => {
|
||||
const selection = Cookies.get("removeArr");
|
||||
if (selection && selection !== "[]") {
|
||||
fetch("http://localhost:8002/remove-entries", {
|
||||
fetch("https://backend.lose.the1s.de/remove-entries", {
|
||||
method: "DELETE",
|
||||
headers: createHeaders(token),
|
||||
body: `{
|
||||
@@ -50,7 +50,7 @@ export const removeSelection = (token: string) => {
|
||||
};
|
||||
|
||||
export const saveRow = (data: any, token: string) => {
|
||||
fetch("http://localhost:8002/save-row", {
|
||||
fetch("https://backend.lose.the1s.de/save-row", {
|
||||
method: "PUT",
|
||||
headers: createHeaders(token),
|
||||
body: JSON.stringify(data),
|
||||
@@ -64,7 +64,7 @@ export const saveRow = (data: any, token: string) => {
|
||||
};
|
||||
|
||||
export const resetData = (token: string) => {
|
||||
fetch("http://localhost:8002/reset-data", {
|
||||
fetch("https://backend.lose.the1s.de/reset-data", {
|
||||
method: "DELETE",
|
||||
headers: createHeaders(token),
|
||||
}).then((response) => {
|
||||
|
@@ -10,7 +10,7 @@ export const logoutAdmin = () => {
|
||||
// Fetch table data and store it in localStorage. Returns the parsed data or null on failure.
|
||||
export const getTableData = async (token: string) => {
|
||||
try {
|
||||
const response = await fetch("http://localhost:8002/table-data", {
|
||||
const response = await fetch("https://backend.lose.the1s.de/table-data", {
|
||||
method: "GET",
|
||||
headers: {
|
||||
Authorization: `Bearer ${token}`,
|
||||
|
@@ -1,15 +1,18 @@
|
||||
import { defineConfig } from "vite";
|
||||
import react from "@vitejs/plugin-react";
|
||||
import svgr from "vite-plugin-svgr";
|
||||
import tailwindcss from "@tailwindcss/vite";
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [react(), svgr(), tailwindcss()],
|
||||
plugins: [tailwindcss()],
|
||||
server: {
|
||||
host: "0.0.0.0",
|
||||
port: 8001,
|
||||
watch: {
|
||||
usePolling: true,
|
||||
allowedHosts: ["lose.the1s.de"],
|
||||
port: 8501,
|
||||
https: false,
|
||||
watch: { usePolling: true },
|
||||
hmr: {
|
||||
host: "lose.the1s.de",
|
||||
port: 8501,
|
||||
protocol: "wss",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
Reference in New Issue
Block a user