Running it locally without lying to yourself
Ports, environment variables, hot reload and the gap between your machine and anywhere else.
Read configuration from the environment from the first commit, not the first deploy. A port that is process.env.PORT ?? 3000 costs nothing today and saves an afternoon later, because every platform you will deploy to assigns the port and expects you to listen on it.
Hot reload is a development-only convenience and it lies in one specific way: it restarts the process, which quietly resets any state you were holding in memory. If your service works locally only because a Map survived between requests, you have written something that cannot run as two instances, and you will find that out on the day traffic justifies a second one.
You should now be able to
- Configure a service through the environment rather than constants
- Name three ways local differs from production
Loading…