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

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.

主站蜘蛛池模板: 铜川市| 增城市| 三台县| 汶川县| 寻乌县| 城市| 贵阳市| 安远县| 合阳县| 丰县| 仪陇县| 中阳县| 永兴县| 凤翔县| 伊春市| 连城县| 巫山县| 南投市| 西昌市| 榆中县| 崇明县| 永新县| 江西省| 郴州市| 潼关县| 琼结县| 石阡县| 万山特区| 疏附县| 衡水市| 措勤县| 南江县| 汝城县| 绥德县| 禹州市| 武宁县| 沁源县| 尼勒克县| 航空| 云龙县| 罗平县|