Node.js tutorial
Simply put, Node.js is JavaScript running on the server side.
Node.js is a platform built on the Chrome JavaScript runtime.
Node.js is an event-driven I/O server-side JavaScript environment based on Google's V8 engine. The V8 engine executes Javascript very quickly and has very good performance.
Who is suitable to read this tutorial?
If you are a front-end programmer and you don't know dynamic programming languages like PHP, Python or Ruby, and then you want to create your own service, then Node.js is a very good choice.
Node.js is JavaScript running on the server side. If you are familiar with Javascript, then you will easily learn Node.js.
Of course, if you are a back-end programmer and want to deploy some high-performance services, then learning Node.js is also a very good choice.
What you need to know before following this tutorial
Before proceeding with this tutorial, you should know some basic computer programming terminology. If you have studied Javascript, PHP, Java and other programming languages, it will help you understand Node.js programming faster.
The version used
We can use the following command to view the current Node version:
$ node -v v4.4.3
Note: There may be differences between different versions There are differences.
The first Node.js program: Hello World!
Script Mode
Here is our first Node.js program:
Example
console.log("Hello World");
Run Example»
Click the "Run Example" button to view the online example
Save the file with the file name helloworld.js and execute it through the node command:
node helloworld.js
After the program is executed, if it is normal, Hello World will be output in the terminal.
Interactive mode
Open the terminal and type node to enter the command interactive mode. You can enter a code statement and execute it immediately and display the result, for example:
$ node > console.log('Hello World!'); Hello World!
Gif example Demonstration
Next we will demonstrate the example operation through Gif pictures: