When launching my express app, I typically use app.listen(PORTNO)
.
The app usually runs on 127.0.0.1:PORTNO
, but oddly enough it also seems to run on 127.0.0.1:3000
.
As far as I know, 3000 is the default port for express applications.
Does anyone understand why this unexpected behavior is happening?
I've attempted changing the environment variable to production and even tried using
http.createServer(app).listen(PORTNO);
My express app files are generated through express-generator
.
In case it matters, I'm working on a Windows machine.
UPDATE:
I start the server with npm start
which executes bin\www
, setting the port for running the server.
However, this still doesn't clarify why the app seems to bind to two different ports - one specified in app.js
and the other in bin\www
- making the app accessible on both of them.
Can someone shed some light on this mystery?