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

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.

主站蜘蛛池模板: 丁青县| 巴里| 商洛市| 井研县| 沾化县| 上饶市| 广宁县| 屯留县| 广丰县| 嫩江县| 黎城县| 观塘区| 比如县| 商城县| 富裕县| 喀喇| 广安市| 中牟县| 行唐县| 曲靖市| 广东省| 四平市| 合水县| 玛多县| 方山县| 大渡口区| 广昌县| 高邮市| 共和县| 土默特左旗| 鹿邑县| 司法| 鹤山市| 南华县| 汉沽区| 广德县| 汨罗市| 台北市| 利津县| 玉林市| 增城市|