Files
OpenFrontIO/src/server/Server.ts
T
2025-04-05 21:39:05 -07:00

26 lines
624 B
TypeScript

import cluster from "cluster";
import * as dotenv from "dotenv";
import { startMaster } from "./Master";
import { startWorker } from "./Worker";
dotenv.config();
// Main entry point of the application
async function main() {
// Check if this is the primary (master) process
if (cluster.isPrimary) {
console.log("Starting master process...");
await startMaster();
} else {
// This is a worker process
console.log("Starting worker process...");
await startWorker();
}
}
// Start the application
main().catch((error) => {
console.error("Failed to start server:", error);
process.exit(1);
});