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

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.

主站蜘蛛池模板: 厦门市| 运城市| 广河县| 拉萨市| 开鲁县| 邵武市| 靖远县| 申扎县| 常德市| 曲松县| 廉江市| 科技| 徐水县| 南江县| 昭通市| 定边县| 江安县| 乌拉特后旗| 四子王旗| 乌拉特后旗| 彰化市| 威远县| 临汾市| 石柱| 泗水县| 台湾省| 蓬莱市| 铁力市| 金坛市| 洛隆县| 丹棱县| 长宁区| 上犹县| 兴山县| 望城县| 会东县| 德保县| 化州市| 久治县| 彝良县| 日喀则市|