By default, I was taught, when I run a local Node server to run it on port 3000.
After reading a tutorial on the Chrome Node debugger which is set to inspect port 9229, I switched to this port.
Here is a similar Q / A on port 3000.
Here is the tutorial.
Can I switch the default to 3000 some how?
This way it will match my Express local port:
app.set('port', (process.env.PORT || 3000));
Or would it be more prudent to change my local express server to 9229?
By default, I was taught, when I run a local Node server to run it on port 3000.
After reading a tutorial on the Chrome Node debugger which is set to inspect port 9229, I switched to this port.
Here is a similar Q / A on port 3000.
Here is the tutorial.
Can I switch the default to 3000 some how?
This way it will match my Express local port:
app.set('port', (process.env.PORT || 3000));
Or would it be more prudent to change my local express server to 9229?
Share Improve this question edited Jun 27, 2019 at 3:04 asked Jun 27, 2019 at 2:28 user11686545user116865451 Answer
Reset to default 23I know this is a super old question in SO time but if anyone else comes here for whatever reason, here's the skinny.
TLDR; Port 3000 is for your application, Port 9229 is for the NodeJS debugger.
Port 9229 is the default NodeJS debugging port. It allows you to attach a debugging tool like Chrome's Inspector or WebStorm's Remote Debug to a Node process that is running with a special flag (node --inspect server.js
in Node v8+ I think, no idea what it was before that). This has nothing to do with what port your listing to in your HTTP application.
Port 3000 is the "recommended" port to run HTTP applications like Express, Koa, Hapi, etc. I have no idea when it was decided that port 3000 was the goto but here we are.
If you want to read more about NodeJS debugging here's a link.