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

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.
主站蜘蛛池模板: 政和县| 洛扎县| 桐城市| 泽库县| 陵水| 德化县| 华阴市| 吴桥县| 沾化县| 岳普湖县| 赞皇县| 蒙阴县| 九江县| 闽侯县| 湘潭市| 永寿县| 唐山市| 聂拉木县| 丁青县| 若尔盖县| 定日县| 罗甸县| 渝北区| 陆川县| 青浦区| 罗田县| 明溪县| 读书| 承德县| 农安县| 江津市| 逊克县| 洪雅县| 来安县| 乐业县| 天镇县| 浦东新区| 拉萨市| 运城市| 丹江口市| 江安县|