Getting the dependent modules in place

Before we start to write any Node.js code, we need to get our dependencies in place by using npm. Since this is a basic app, we will be using it to test our Node.js connectivity with the MongoDB server. So, the only dependent module that we need is the native MongoDB client for Node.js. We can easily install that by executing the following command:

    $ npm install MongoDB --save

After npm installs the MongoDB driver, you can list the contents of the directory and you will notice that a new folder was created, node_modules. This is where, surprisingly enough, all Node modules are stored whenever you install them from npm. Inside the node_modules folder, there should be a single folder named MongoDB. Also, you will notice that the package.json file of our sample application will be updated by this new dependency entry.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.137.7