🚀 Quizzy
Deployed an Express App to the Cloud (with Render)

🧑💻Source code
🚀Live on
Deploying an Express.js app on the cloud isn’t as daunting as it sounds — especially with Render, which offers clear and concise documentation (https://render.com/docs/deploy-node-express-app) to guide.
✅ My Deployment Process
I started by uploading my project to GitHub and followed the steps outlined in Render’s docs. Simple and effective!
⚠️ Error I Encountered
Initially, I hardcoded the port number in my Express app (const port = 3000), which caused the deployment to fail.
💡 How I Fixed It
To make my app cloud-compatible, I:
Created a
.envfile with:
PORT=3000Installed the
dotenvpackage.In my app:
Imported dotenv:
import dotenv from "dotenv";Configured it:
dotenv.config();Applied:
const port = process.env.PORT || 3000;
Overrode the environment variable in the Render dashboard (you can set it under the "Environment" tab).
⚙️ Optimizations
I also ensured a clean GitHub push by using a .gitignore file to exclude:
node_modules/.envpackage-lock.json
🤯 Fun Fact
Even if you don’t use the dotenv package or don’t manually set the port, it still works on Render.
That’s because:
Render automatically provides a
PORTvia environment variables.The default port is typically
10000(but the app still needs to bind toprocess.env.PORT).



