App Development Vocabulary — Day 28: Port
An address gets a message to the right machine. A port gets it to the right program on that machine.
Every endpoint (Day 7) you've called had a port in it, even when you couldn't see it:
http://localhost:3000/users says the 3000 out loud
A few worth recognizing:
80: http
443: https
5432: Postgres
3306: MySQL
6379: Redis
3000 / 5173 / 8080: common dev servers
Two rules explain most port errors. One program per port, so a second copy of your app on 3000 fails to start. And the port in your frontend's request has to match the port the backend is listening on, or you get a "connection refused" error that looks scarier than it is.
Quick check: Your backend says "Listening on port 4000" but your frontend is calling http://localhost:3000/api/users. What happens?
## SPOKEN LINES
  • The terminal says port 3000 is already in use, and nothing loads. Your laptop is juggling a browser, Spotify, a video call and your app, and two of them wanted the same number.
  • - PORT
  • - A port is a number that says which program on a machine a message is for. Localhost is the building with one street address, and the port is the apartment number.
  • - Websites use 443 for https, Postgres listens on 5432, and development servers grab 3000, 5173 or 8080.
  • - So a port is the number that picks out one service on a machine. Tomorrow: Server, the computer on the other end of all these requests.
## NEXT
Day 29: Server
0
0 comments
Joshua Payne
4
App Development Vocabulary — Day 28: Port
CMD & Conquer
skool.com/cmdandconquer
CMD & Conquer helps designers, filmmakers, photographers, developers, and business owners build an office of agents around their work.
Powered by