Most of the coding work we do in weeks 3 to 5 will be driven by the back-end web development framework Express. We'll install Express individually in each project we create. For now, we'll install the other tools we'll use along with Express.
Note: When copying the code snippets, exclude the ➜
as you run the code in your Terminal. The ➜
is simply an indicator of the user in the Terminal. Notice the $
in your Terminal changed to an ➜
now that we're using zsh
instead of bash
!
- Install Node.js with Homebrew by running the following command in the Terminal:
➜ brew install node
-
Run the Terminal command
which node
to check that Node.js was installed. You should see a file path. The Terminal commandnode
changes your Terminal into a Javascript REPL ("Read Evaluate Print Loop"), like the right-hand side of repl.it. Typectrl + c
twice to quit out of the REPL and return to the normal Terminal commands. -
Run the Terminal command
which npm
to check that NPM is installed. The Node Package Manager, used through variousnpm
commands, is a lot like Homebrew, except we'll use it for Node.js-specific tools instead of for general Mac tools. NPM packages are often called "node modules."
Nodemon (short for "node monitor") will make our Node.js workflow more efficient.
- Install nodemon globally with the following Terminal command:
➜ sudo npm install -g nodemon
It's time to install another Sublime Text package!
- From the command palette in Sublime Text (
cmd + shift + p
), selectPackage Control: Install Package
to bring up the list of available packages. SelectSublimeLinter
from the list, and Package Control will install it for you. - Repeat the step above to install the package
SublimeLinter-jshint
. - Now Sublime Text 3 has the packages we need, but we also need to install the linter program,
jshint
. In the Terminal, runsudo npm install -g jshint
to install jshint globally.
MonogDB is a database that stores information as easy to read "documents". We'll use it to store data in our Node.js and Express stack.
- Use Homebrew to update all our brew packages.
➜ brew update
- Run
brew install
for MongoDB.
➜ brew install mongodb
- Then we'll need a directory for MongoDB to save data.
➜ sudo mkdir -p /data/db
- Finally we'll want to make sure we have permission to read and write to this directory.
➜ sudo chown -R $USER /data/db
- Run two commands to check whether the install worked. You should see a file path after each command.
➜ which mongod
➜ which mongo