Objective:
node. js Introduction, installation and configuration, the previous section has been introduced, if there is unclear can also leave a message or directly ask Niang.
This section:
This section focuses on a simple example of node. js, using two methods. This is described below.
In short, this section is very simple. Look down, everybody.
Script mode:
That is, create a new code file, and then use the node command to execute the file with the following steps:
1. Under the E:\NodejsDemo folder, create a new "helloworld.js" file, with the following code:
1 console.log ("Hello world! ");
A very simple sentence, which is the output command often used in browser debugging.
2. Open dos, switch to E:\NodejsDemo, and then run "Node Helloworld.js" to execute the file:
Ps: Is there a feeling of déjà vu? Haha, is the execution command in Java similar to this?
Interactive mode:
That is, typing the code directly into DOS is simple:
Open DOS, enter "Node", then go to MySQL-like command line mode:
We then enter "Console.log" ("Hello world!") at the cursor. :
Summary:
Feel is not very simple to get started, hehe.
In fact. If you feel your JS level is very high, you think that node. js is easy to conquer, then you are wrong.
I can only say: June do not know the depth of water.
The next section describes how to build a node. js http Server.
node. JS Tutorial 02-Classic Hello World