官术网_书友最值得收藏!

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.

主站蜘蛛池模板: 永胜县| 连城县| 金溪县| 茂名市| 湘乡市| 九台市| 奎屯市| 阆中市| 遂昌县| 大洼县| 林芝县| 北辰区| 武汉市| 墨江| 吉首市| 东港市| 横峰县| 景谷| 昌黎县| 伊春市| 图片| 乌拉特中旗| 泸州市| 红原县| 石棉县| 白水县| 英吉沙县| 南汇区| 大连市| 磐石市| 河北省| 静宁县| 砚山县| 永福县| 新建县| 名山县| 遂川县| 新乡县| 新干县| 杨浦区| 五家渠市|