Small white learn about node. JS Records

Source: Internet
Author: User

I have no knowledge of node. js, pure white one, want to learn the original intention is to understand what node. js is what, can use it to do something, white is the curiosity. Next, record your learning process.

Note: If you have any errors, please indicate that you learn from each other. Segmentfault StackOverflow

Who is suitable to read this tutorial?

If you're a front-end programmer and you don't know a dynamic programming language like PHP, Python, or Ruby, then you want to create your own service, then node. JS is a great choice.

node. JS is JavaScript running on the server, and if you're familiar with JavaScript, you'll easily learn to node. js.

Of course, if you're a back-end programmer and want to deploy some high-performance services, learning node. JS is also a great option.

Simply put, node. JS is the JavaScript that runs on the server.

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 the Google V8 engine, the V8 engine executes JavaScript very quickly and with great performance. Excerpt

Www.npmjs.com community Look at Nodejs version upgrades, new features, important bug fixes, github.com a large number of projects and source code, stackoverflow.com Technical solution community and query related resources, environment configuration, anomalies can find the answer.

node. js even is a stable version odd-numbered is an unstable version

Node Installation address : http://nodejs.cn/download/Download the different installation packages according to your own system.

node. JS callback function

Understand the difference between blocking and non-blocking calls. The first instance finishes executing the program after the file has been read. In the second instance, we don't have to wait for the file to be read, so we can execute the next code while reading the file, which greatly improves the performance of the program.

As a result, blocking is performed sequentially, not blocking is not required in order, so if you need to handle the parameters of the callback function, we need to write it inside the callback function.

Note: Callback functions can do asynchronous processing; blocking and non-blocking = = Synchronous and Asynchronous

node. JS is a single-process single-threaded application, but it supports concurrency through events and callbacks, so performance is very high.

Each of the APIs for node. JS is asynchronous and runs as a standalone thread, using an asynchronous function call, and handling concurrency.

node. js basically all of the event mechanisms are implemented using the Observer pattern in design mode.

process reading and writing; management of network process

Win+r shortcut key to cmd window

Install according to the downloaded installation package; My is win, (PS: Too poor) in cmd enter input node-v view node version number (node--version)

If there is not an internal command that you entered, it is your environment variable that has no paths in path and needs to be added manually.

Linux in Cat/etc/redhat-release view CentOS version

Rpm-q gcc rpm-q gcc-c++ see if the installation

Yum-y Install gcc gcc-c++ kernel-devel installing GCC gcc-c++

Gyp Cross-platform management tool management process, Gyp is written by Python, so Python 2.7 is not recommended to use Python 3

Mac Xcode Compiler

Test data: Server.js

Next, write a little chestnut:

Student.js

Teacher.js:

Kclass.js

Index.js

Index.js Entry file Run

Questions????? How does node. js access in the browser?????? 、、

Small white learn about node. JS Records

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.