diff --git a/README.md b/README.md index 764ee75..1753b0a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # MERN Stack Project: Build and Deploy a Real Time Chat App | JWT, Socket.io -![Demo App](https://i.ibb.co/gFSMzKN/1.png) +![Demo App](https://i.ibb.co/fXmZdnz/Screenshot-10.png) [Video Tutorial on Youtube](https://youtu.be/HwCqsOis894) diff --git a/backend/server.js b/backend/server.js index 3161a66..f8f7764 100644 --- a/backend/server.js +++ b/backend/server.js @@ -10,11 +10,11 @@ import userRoutes from "./routes/user.routes.js"; import connectToMongoDB from "./db/connectToMongoDB.js"; import { app, server } from "./socket/socket.js"; -const PORT = process.env.PORT || 5000; +dotenv.config(); const __dirname = path.resolve(); - -dotenv.config(); +// PORT should be assigned after calling dotenv.config() because we need to access the env variables. Didn't realize while recording the video. Sorry for the confusion. +const PORT = process.env.PORT || 5000; app.use(express.json()); // to parse the incoming requests with JSON payloads (from req.body) app.use(cookieParser());