added comprehensive ports for networking

This commit is contained in:
2025-07-25 11:59:33 +02:00
parent fcb8af574c
commit 7f74a740ae
5 changed files with 48 additions and 31 deletions

View File

@@ -118,7 +118,7 @@ app.post("/api/updateUser", authenticate, async (req, res) => {
});
app.listen(port, () => {
console.log(`Express backend server is running at http://localhost:${port}`);
console.log(`Express backend server is running at Port: ${port}`);
});
// error handling code

View File

@@ -1,33 +1,42 @@
services:
# admin_react-frontend:
# container_name: bikelane-frontend_react-admin
# build: ./frontend_admin
# ports:
# - "5001:5001"
# environment:
# - CHOKIDAR_USEPOLLING=true
# volumes:
# - ./frontend_admin:/app
# - /app/node_modules
# restart: unless-stopped
admin_react-frontend:
container_name: bikelane-frontend_react-admin
build: ./frontend_admin
ports:
- "5001:5001"
networks:
- proxynet
- bikelane_network
environment:
- CHOKIDAR_USEPOLLING=true
volumes:
- ./frontend_admin:/app
- /app/node_modules
restart: unless-stopped
# user_react-frontend:
# container_name: bikelane-frontend_react-user
# build: ./frontend_user
# ports:
# - "5003:5003"
# environment:
# - CHOKIDAR_USEPOLLING=true
# volumes:
# - ./frontend_user:/app
# - /app/node_modules
# restart: unless-stopped
user_react-frontend:
container_name: bikelane-frontend_react-user
build: ./frontend_user
networks:
- proxynet
- bikelane_network
ports:
- "5003:5003"
environment:
- CHOKIDAR_USEPOLLING=true
volumes:
- ./frontend_user:/app
- /app/node_modules
restart: unless-stopped
bikelane-backend:
container_name: bikelane-backend_express
build: ./backend
ports:
- "5002:5002"
networks:
- proxynet
- bikelane_network
environment:
DB_HOST: mysql
DB_USER: root
@@ -43,6 +52,8 @@ services:
container_name: bikelane-mysql
image: mysql:8.0
restart: unless-stopped
networks:
- bikelane_network
environment:
MYSQL_ROOT_PASSWORD: D7Ze0lwV9hMrNQHdz1Q8yi0MIQuOO8
MYSQL_DATABASE: bikelane
@@ -53,3 +64,9 @@ services:
volumes:
mysql-data:
networks:
proxynet:
external: true
bikelane_network:
external: false

View File

@@ -18,7 +18,7 @@ const LoginCard: React.FC<LoginCardProps> = ({ onClose, changeAuth }) => {
e.preventDefault();
setError("");
try {
const response = await fetch("http://localhost:5002/api/login", {
const response = await fetch("http://45.133.75.67/:5002/api/login", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ username, password }),

View File

@@ -33,7 +33,7 @@ export function useUsers(): UserReturn {
const fetchUsers = async () => {
try {
const response = await fetch("http://localhost:5002/api/getAllUsers", {
const response = await fetch("http://45.133.75.67:5002/api/getAllUsers", {
method: "GET",
headers: headers,
});
@@ -50,7 +50,7 @@ export function useUsers(): UserReturn {
};
const deleteUser = (id: number) => {
fetch("http://localhost:5002/api/deleteUser", {
fetch("http://45.133.75.67:5002/api/deleteUser", {
method: "POST",
body: JSON.stringify({ id: id }),
headers: {
@@ -109,7 +109,7 @@ export function useUsers(): UserReturn {
console.log("Sending user data:", userData);
try {
const response = await fetch("http://localhost:5002/api/updateUser", {
const response = await fetch("http://45.133.75.67:5002/api/updateUser", {
method: "POST",
body: JSON.stringify(userData),
headers: {

View File

@@ -6,7 +6,7 @@ export const loginUser = async (
password: string
): Promise<boolean> => {
try {
const response = await fetch("http://localhost:5002/api/login", {
const response = await fetch("http://45.133.75.67:5002/api/login", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ username, password }),
@@ -31,7 +31,7 @@ export const logout = () => {
};
export const deleteUser = (id: number) => {
fetch("http://localhost:5002/api/deleteUser", {
fetch("http://45.133.75.67:5002/api/deleteUser", {
method: "POST",
body: JSON.stringify({ id: id }),
headers: {
@@ -53,7 +53,7 @@ export const deleteUser = (id: number) => {
export const replaceUsers = async () => {
localStorage.removeItem("users");
await fetch("http://localhost:5002/api/getAllUsers", {
await fetch("http://45.133.75.67:5002/api/getAllUsers", {
method: "GET",
headers: {
Authorization: `Bearer ${Cookies.get("token")}`,
@@ -104,7 +104,7 @@ export const updateUserFunc = async (userID: number) => {
console.log("Sending user data:", userData);
try {
const response = await fetch("http://localhost:5002/api/updateUser", {
const response = await fetch("http://45.133.75.67:5002/api/updateUser", {
method: "POST",
body: JSON.stringify(userData),
headers: {