Create a new folder for your project and open it:
$ mkdir test-project
$ cd test-project
You need to create and setup a new node project in this folder. Running npm init
will guide you through setting the project information. You can just use the defaults for now.
$ npm init
This will add a file called package.json
to your folder with all the information needed to run your application.
Now we want to install some Node packages so that we can get started. The three packages we need are:
- [Mongoose] - A Node package to work with the MongoDB database within Javascript
- [Express] - A middleware framework that allows us to build endpoints
- [body-parser] - An addon to Express that allows us to configure the types of supported endpoint requests.
In order to install these packages, use the handy install command:
$ npm install --save express body-parse mongoose