BACKEND DONE FOR ALL APPS

This commit is contained in:
andrei-mihnea-cerbu
2024-10-21 18:34:45 +03:00
parent 4157ca9e7d
commit ab1eaec413
349 changed files with 17199 additions and 14015 deletions
+25
View File
@@ -0,0 +1,25 @@
import {TcpServer} from "./tcp_server";
import {UdpServer} from "./udp_server";
import dotenv from "dotenv";
import path from "path";
dotenv.config({ path: path.join('..', '.env') });
const UDP_PORT: number = process.env.UDP_PORT ? parseInt(process.env.UDP_PORT) : 41234;
const TCP_PORT: number = process.env.TCP_PORT? parseInt(process.env.TCP_PORT): 41233
const HOST: string = process.env.HOST || '0.0.0.0';
// Function to handle server logs (not needed when starting directly)
const handleServerLogs = (serverName: string): void => {
console.log(`${serverName} started successfully.`);
};
// Start the UDP server
const udpServer = new UdpServer(HOST, UDP_PORT);
udpServer.start();
handleServerLogs('UDP Server');
// Start the TCP server
const tcpServer = new TcpServer(HOST, TCP_PORT);
tcpServer.start();
handleServerLogs('TCP Server');