Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAllison Walker
17,137 PointsWhat is bin?
A folder called 'bin' is installed with Express Generator. What it is?
1 Answer
Casey Ydenberg
15,622 PointsGenerally the "bin" is a directory of scripts that can be directly executed. The bin at the root of a Linux OS is where all the programs that be accessed via the command line live.
If you look in the package.json file made by the Express Generator, you'll notice under "scripts" that it has one entry: start: ./bin/www
. This tells Node to execute that script when you run npm start
from the command line which starts your server (the Node default is to start server.js
). Don't ask me why it's not www.js. You can put other stuff in the bin you'd like npm to run, e.g. if you want to use NPM to build assets or if you want different server files for development vs. production.