You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.
It's possible, but I don't see a huge advantage of doing this. This seems like it would only be useful in development environment. In my experience, most staging/production environments will expect a specific port to run the application in, or the environment itself (not the application) will assign a port when the app starts; this is the reason for process.env.PORT in the various env configurations.
If you wanted to achieve this, you could abstract the assignment of the port, in your express configuration, out into a recursive function that checks the availability of a port number, and returns the first available. You might want to have a max amount of tries for this, and/or base this off of a range of available port numbers. I believe express has a way for you to check if a port is in use already.
@keithics Simply assign a different port number to each of your meanjs instance, the first paragraph in @mleanos answer above; many different way to do it; the simplest, arguably, is to mention the port number as an environment variable in your command line (when starting the instance).
The text was updated successfully, but these errors were encountered: