add shared node modules

This commit is contained in:
2026-07-07 11:32:55 +02:00
parent 8ebdbc14d6
commit 4a73c43f80
5 changed files with 13 additions and 31 deletions
+1
View File
@@ -43,6 +43,7 @@ Temporary Items
.apdisk
ToDo.txt
.idea
.env
.docker/volumes
+2 -1
View File
@@ -5,7 +5,8 @@
"main": "server.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node server.js"
"start": "node server.js",
"dev": "node --watch server.js"
},
"keywords": [],
"author": "",
+1 -1
View File
@@ -94,7 +94,7 @@ const runStartup = async (port) => {
}
console.log("Everything is settet up successfully!");
console.log(`Server is running on http://localhost:${port}`);
console.log(`Backend is running on http://localhost:${port}`);
};
const insertFirstData = async () => {
+7 -8
View File
@@ -1,16 +1,15 @@
import bodyParser from "body-parser";
import { SignJWT, jwtVerify } from "jose";
import {jwtVerify, SignJWT} from "jose";
import env from "dotenv";
env.config();
const secret = new TextEncoder().encode(process.env.SECRET_KEY);
export async function generateToken(payload) {
const newToken = await new SignJWT(payload)
.setProtectedHeader({ alg: "HS256" })
.setIssuedAt()
.setExpirationTime("24h") // Token valid for 24 hours
.sign(secret);
return newToken;
return await new SignJWT(payload)
.setProtectedHeader({alg: "HS256"})
.setIssuedAt()
.setExpirationTime("24h") // Token valid for 24 hours
.sign(secret);
}
export async function authenticate(req, res, next) {
+2 -21
View File
@@ -3,7 +3,7 @@ services:
container_name: stockhome-mysql
image: mysql:8.0
ports:
- "3312:3306"
- "3306:3306"
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
@@ -16,23 +16,4 @@ services:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
interval: 5s
timeout: 3s
retries: 20
backend:
container_name: stockhome-backend
ports:
- "8004:8004"
build:
context: ./backend
dockerfile: Dockerfile
environment:
DB_HOST: stockhome-mysql
DB_USER: root
DB_NAME: stockhome
DB_PASSWORD: ${MYSQL_ROOT_PASSWORD}
SECRET_KEY: ${AUTH_SIGNATURE}
NODE_ENV: production
depends_on:
database:
condition: service_healthy
restart: unless-stopped
retries: 10