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

The built-in module to use require()

Now, to kick things off, the first thing I will do is to use console.log to print Starting app, as shown in the following code:

console.log('Starting app');
The only reason we'll do this is to keep track of how our files are executing, and we'll do this only for the first project. Down the line, once you're comfortable with how files get loaded and how they run, we'll be able to remove these console.log statements, as they won't be necessary.

After we call the console.log starting app, we'll load in a built-in module using require().

We can get a complete list of all of the built-in modules in the Node.js API docs.

To view Node.js API docs, go to nodejs.org/api. When you go to this URL, you'll be greeted with a long list of built-in modules. Using the File System module we'll create a new file and the OS module. The OS module will let us fetch things such as the username for the currently logged-in user.

主站蜘蛛池模板: 喜德县| 仁化县| 岳普湖县| 温州市| 桐城市| 巨鹿县| 温宿县| 新昌县| 金坛市| 新平| 临澧县| 大城县| 古蔺县| 海城市| 湖南省| 穆棱市| 三亚市| 伊金霍洛旗| 泽普县| 吉水县| 酒泉市| 金华市| 望城县| 来凤县| 吉木乃县| 宁化县| 浦县| 南木林县| 星座| 宁武县| 永丰县| 陆丰市| 盱眙县| 明溪县| 林西县| 滦平县| 广灵县| 葫芦岛市| 浦城县| 兴化市| 香河县|