Ports are like apartment numbers for programmes on a computer:

  • A computer has one IP address
  • Different programmes listen on different ports
  • Web servers typically use port 80 (HTTP) or 443 (HTTPS)
  • During development, we often use 3000, 4000, 5000, etc.

Example URLs with ports:

  • http://localhost:3000 - Our local API as we set PORT=3000
  • http://localhost:5432 - Our local database
  • https://google.com - Port 443 (hidden because it’s default)
Tags: