Node.js learning-initial node, node basic introduction, environment installation, run the first node program.

1.node basic introduction

Why learn Node.js?

  • As a front-end development engineer, Node.js has become an indispensable content in the technology stack. If you want to go further in the front-end development position, you must continue to learn and make your technology stack more and more powerful.
  • Nowadays, when recruiting, many companies require the job site to know the server language. As a server that can be developed using Javascript, node.js is easier to learn and use for the front end.
  • Familiar with the server is easier and smoother in the front-end collaborative development, in order to better cooperate with the development of the server-side developers.

What is node.js?

  • Node.js is a JavaScript runtime based on the Chrome V8 engine (introduced on the official website).
  • Node.js is not a language, a framework, or a library.
  • Node.js is a JavaScript runtime environment.
  • We can run the js code that was previously running in the browser in Node.js.

JavaScript in Node.js:

  • There is no BOM, DOM operation, because it is not operated in a browser, but as a server-side language.

  • Compliant with ECMAScript standard

  • Some server-level API operations are provided for Javascript in the Javascript execution environment of Node.

    • File read and write fs
    • Network service construction
    • http server
    • wait wait wait.

Features of Node.js

  • event-driven event-driven
  • non-blocking I/O model
  • lightweight and efficient

What can Node.js do?

  • Used as a web server backend.
  • Develop command line tools
  • Web crawler
  • Package management tool
  • and many more.

2. Node environment installation

Node.js official website: https://nodejs.org/en/
Node.js Chinese website: http://nodejs.cn/

Environmental installation

  1. Enter the official website
    Insert picture description here
  2. Select the version The one
    Insert picture description here
    on the left is the stable version, and the one on the right is the latest version. Here you can directly select the one on the left to download, and then select the configuration of your computer.
  3. Download and install (next is ok)
  4. Check whether the installation is successful or not
    . Enter in the cmd window:
node --version

Insert picture description here
If a version appears, it means that the Node.js environment has been installed successfully.

3. The first node program runs

Steps :

  1. Create a JavaScript script file.
    Insert picture description here
  2. Run in the cmd terminal to
    run the code:
node 00-helloworld,js //node js文件
  1. result
    4

to sum up

Node.js is a compulsory course for front-end development engineers, and we must learn to master it. This article mainly introduces Node.js and runs the first node.js program. After having a preliminary understanding of Node.js, through learning, we will be able to master the charm of Node.js.

Guess you like

Origin blog.csdn.net/qq_41497756/article/details/109200686