How Express Runs Locally
Your computer is the server. The browser talks to localhost on a port (usually 3000).
Clone and install
git clone https://github.com/VenkatMastercoder/github-action-ci-cd.git
cd github-action-ci-cd
npm iTest, then start
npm run test
npm run start| Step | Purpose |
|---|---|
npm i | Install Express and other dependencies |
npm run test | Verify routes and logic before you start the server |
npm run start | Run the Node.js app |
What happens internally
Browser → localhost:3000 → Express Server → Response → Browser
- App listens on port 3000
- Only reachable on your machine (
localhost) - Ideal for development and testing
Locally, your Express app runs on your computer and handles requests through a port like 3000.
How Express Runs on AWS EC2
On EC2 the app runs on a remote Ubuntu host and can be reached over the public internet.
1. Launch an instance
- Ubuntu recommended
- Open security group ports: 22 (SSH), and 3000 (app) or 80/443 (once Nginx is in place)
2. Connect and prepare the host
ssh -i your-key.pem ubuntu@your-ec2-ip
sudo apt update
sudo apt install nodejs npm git -y3. Clone, install, and test
git clone https://github.com/VenkatMastercoder/github-action-ci-cd.git
cd github-action-ci-cd
npm i
npm run test4. Keep the process alive with PM2
npm install -g pm2
pm2 start app.js --name app
pm2 save
pm2 startupPM2 restarts the app if it crashes and can start it again after a reboot.
How traffic looks on EC2
Browser → EC2 public IP:3000 → Express (PM2) → Response
| Local | EC2 |
|---|---|
| Your laptop is the server | A remote VM is the server |
localhost only | Public IP (and later a domain) |
| Fine for dev | Required for real users |
Next you will automate install → test → restart with GitHub Actions instead of typing these commands by hand on every change.