From 7e4e0c0c6a92a8c7bd9b074508e2cf3d196e2f2e Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 2 Mar 2024 22:57:32 -0500 Subject: [PATCH] fixing port for deployment --- client/vite.config.ts | 3 ++- server/dist/index.js | 7 ++++--- server/index.ts | 6 +++--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/client/vite.config.ts b/client/vite.config.ts index 9174a0c..23fd333 100644 --- a/client/vite.config.ts +++ b/client/vite.config.ts @@ -7,12 +7,13 @@ import react from '@vitejs/plugin-react'; import dotenv from 'dotenv'; dotenv.config(); -const { PORT = 8000 } = process.env; +const { PORT = 3000 } = process.env; export default defineConfig({ base: './', plugins: [react()], server: { + port: 10000, proxy: { '/api': { target: `http://localhost:${PORT}`, diff --git a/server/dist/index.js b/server/dist/index.js index 8770202..7fdbdb2 100644 --- a/server/dist/index.js +++ b/server/dist/index.js @@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); // server/index.ts const express_1 = __importDefault(require("express")); const db_1 = __importDefault(require("./config/db")); +const config_1 = __importDefault(require("./config/config")); const cors_1 = __importDefault(require("cors")); const helmet_1 = __importDefault(require("helmet")); const compression_1 = __importDefault(require("compression")); @@ -17,7 +18,7 @@ const user_routes_1 = __importDefault(require("./routes/user.routes")); // Updat const auth_routes_1 = __importDefault(require("./routes/auth.routes")); // Update extension to .ts const app = (0, express_1.default)(); console.log("PORT process.env: ", process.env.PORT); -const port = process.env.PORT || 8000; +//const port = process.env.PORT || 8000; // Connect to MongoDB (0, db_1.default)(); // Middleware @@ -35,6 +36,6 @@ app.use('/', question_routes_1.default); app.get('/', (req, res) => { res.send('Hello from the server!'); }); -app.listen(port, () => { - console.log(`Server is running on port ${port}`); +app.listen(config_1.default.port, () => { + console.log(`Server is running on port ${config_1.default.port}`); }); diff --git a/server/index.ts b/server/index.ts index 8da46bc..3cfad29 100644 --- a/server/index.ts +++ b/server/index.ts @@ -14,7 +14,7 @@ import authRoutes from './routes/auth.routes'; // Update extension to .ts const app = express(); console.log("PORT process.env: ", process.env.PORT); -const port = process.env.PORT || 8000; +//const port = process.env.PORT || 8000; // Connect to MongoDB connectDB(); @@ -37,6 +37,6 @@ app.get('/', (req, res) => { res.send('Hello from the server!'); }); -app.listen(port, () => { - console.log(`Server is running on port ${port}`); +app.listen(config.port, () => { + console.log(`Server is running on port ${config.port}`); });