There are questions and answers dealing with the new www file in the folder bin for express 4. However I could not find the current question: Why eventhough www is a javascript file, it does not have the js extension?
Asked
Active
Viewed 1,925 times
2
-
No reason it couldn't be..., also see https://stackoverflow.com/questions/36638123/learning-node-js-express-js-whats-the-deal-with-bin-www?rq=1 for why it is bin\www – Cody G Dec 06 '18 at 04:22
-
so no special reason it does not have the extension? Could it work the same if it is `www.js`? – KansaiRobot Dec 06 '18 at 04:32
-
Yeah it's definitely not a requirement, you might have to change your `npm start` script from `node bin/www` to `node bin/www.js` but maybe not even that – Cody G Dec 06 '18 at 04:35
1 Answers
3
I imagine that the maintainer of express uses many executable shell scripts, which are generally left without the extension. And since you're executing this as a node script, it is also an executable. See https://askubuntu.com/questions/503127/should-i-save-my-scripts-with-the-sh-extension
You can add the extension, everything should still work.
And as an aside, the reason for using the bin/www instead of running app.js directly: Learning node.js/express.js: What's the deal with bin/www?

Cody G
- 8,368
- 2
- 35
- 50