I. Introduction to Node. js to persuade you to read this simple instruction, it is necessary to advertise Node. js first. First, let's see who is using Node. js. It's always a big difference to be mixed with industry leaders. First, Microsoft's cloud service Azure has started to Support Node. js and E... SyntaxHighlighter. all ()
1. Introduction to Node. js
To persuade you to read this simple instruction, it is necessary to advertise Node. js first. First, let's see who is using Node. js. It's always a big difference to be mixed with industry leaders. First of all, Microsoft's cloud service Azure has begun to Support Node. js, and Ebay, Yahoo, and Linkedin. Is it a bit of a spirit? Well, let's continue. The following is a self-introduction on the official website:
--------------------------------------------------------------------------------
Node. js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications. node. js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across SS distributed devices.
Node. js is a platform built on the Chrome JavaScript runtime to build fast and scalable network applications. Node. js uses the event-driven, non-blocking I/O mode, which makes it lightweight and efficient and can perfectly run real-time applications with high data throughput on distributed devices.
--------------------------------------------------------------------------------
If the official website does not contain porn, I think you should be interested in spending five minutes browsing the following content.
Ii. Installation
Here only describes the installation of Windows platform, very simple, go to the official website to download the installation package, run, OK.
After the installation is complete, you may find a shortcut. Sorry, although your eyes are better than mine, you cannot find them. Do not worry. By default, the installation package copies all Files to the "C: \ Program Files \ nodejs" directory. Then, you have carefully set the path in the system environment variables. Now, open a command line window and enter:
> Node
>
If you get a prompt and the system does not warn you that "Sorry, there is no such command", congratulations, the installation is successful. If you still want to observe the directory structure of nodejs, you will also find that it is much simpler to upload a node.exe file. Is there anything simpler than this?
Ah? Do you have an npm. cmd batch file and node_modules folder? That, we can ignore it for the moment. You can delete them without affecting the use of node. js.
However, since we mentioned them, npm is used to manage modules, while node. the charm of js lies in its modularization. The kernel only does what the kernel should do. Everything else can be achieved through the extension of modules. This also makes node. js useless.
Cute modules are usually embedded in the node_modules folder.
Iii. Console Commands and REPL
Now that we get the node. js prompt, we are now in the node. js environment. In this environment, all your Javascript knowledge can be used, because node. js uses the famous v8 engine. Note that node. js calls this Read-Eval-Print-Loop, which means that we can run js Code interactively here. I feel like I have returned to the age when I first learned Basic. Nostalgia and nostalgia.
> A = [1, 2, 3];
[1, 2, 3]
> A. forEach (function (v ){
... Console. log (v );
...});
1
2
3
There are a few console commands that can be found using help. The only thing you need to note is that these commands must be preceded by a small dot:
Now you can start your node. js journey. Of course, if you want.
From watching the cloud