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

Creating the Node application

The first step will be to create a folder. Every project we create will go live inside of its own folder. I'll open up the Finder on macOS and navigate to my desktop. What I'd like you to do is open up the desktop on your OS, whether you're on Linux, Windows, or macOS, and create a brand new folder called hello-world.

I don't recommend using spaces in your project file or folder names, as it only makes it more confusing to navigate inside of Terminal. Now, we have this hello-world folder and we can open it up inside of our editor.

Now I'll use command + O (Ctrl + O for Windows users) to open up, and I'll navigate to the desktop and double-click my hello-world folder, as shown here:

On the left I have my files, which are none. So, let's create a new one. I'll make a new file in the root of the project, and we'll call this one app.js, as shown here:

This will be the only file we have inside our Node application, and in this file we can write some code that will get executed when we start the app.

In the future, we'll be doing crazy stuff like initializing databases and starting web servers, but for now we'll simply use console.log, which means we're accessing the log property on the console object. It's a function, so we can call it with parentheses, and we'll pass in one argument as string, Hello world!. I'll toss a semicolon on the end and save the file, as shown in the following code:

console.log('Hello world!');

This will be the first app we run.

Now, remember, there is a basic JavaScript requirement for this course, so nothing here should look too foreign to you. I'll be covering everything new and fresh inside of this course, but the basics, creating variables, calling functions, those should be something you're already familiar with.
主站蜘蛛池模板: 芦山县| 开平市| 安化县| 健康| 肇州县| 蒙城县| 漳浦县| 武冈市| 吴川市| 原平市| 东丽区| 平安县| 石屏县| 会泽县| 宜丰县| 乌审旗| 肃宁县| 拉萨市| 郓城县| 花莲市| 分宜县| 凤庆县| 张家港市| 天柱县| 武强县| 南江县| 蒲城县| 新沂市| 平和县| 柳州市| 宕昌县| 囊谦县| 齐齐哈尔市| 神池县| 廊坊市| 龙江县| 星子县| 潼关县| 绥德县| 西丰县| 南昌市|