Home >Web Front-end >Front-end Q&A >What are the main functions of node js
The main function of node js is to write network applications like web servers, and because Node.js is event-driven, developers can develop a server that can host high concurrency without using threads. .
The operating environment of this article: Windows 7 system, nodejs version 10.16.2, Dell G3 computer.
What are the main functions of node js?
Node.js is an open source, cross-platform execution environment that can run JavaScript on the server side. Node.js is owned and maintained by the OpenJS Foundation (formerly the Node.js Foundation, which merged with the JS Foundation) and is a project of the Linux Foundation. Node.js uses the V8 execution code developed by Google and uses technologies such as event-driven, non-blocking and asynchronous input and output models to improve performance and optimize the transmission volume and scale of applications. These techniques are typically used in data-intensive real-time applications.
Node.js Most of the basic modules are written in JavaScript language. Before the emergence of Node.js, JavaScript was usually used as a client-side programming language, and programs written in JavaScript were often executed on the user's browser. The emergence of Node.js enables JavaScript to be used for server-side programming. Node.js contains a series of built-in modules that allow the program to be executed as an independent server without Apache HTTP Server or IIS.
Currently, Node.js has been adopted by IBM, Microsoft, Yahoo![10], Walmart, Groupon, SAP, LinkedIn, Rakuten, PayPal, Voxer, GoDaddy and other companies.
Overview
Node.js can be used to write server-side applications and network-related applications through JavaScript and a series of modules. [20][21][22] The core modules include file system I/O, network (HTTP, TCP, UDP, DNS, TLS/SSL, etc.), binary data flow, encryption algorithm, data flow, etc. [21][23] The API form of the Node module is simple, which reduces the complexity of programming.
Using frameworks can speed up development. Commonly used frameworks include Express.js, Socket.IO, Connect, etc. [24] Node.js programs can run on Microsoft Windows, Linux, Unix, Mac OS X and other servers. Node.js can also use CoffeeScript (an alternative language designed to simplify JavaScript, its code can be converted into legal JavaScript code according to certain rules), TypeScript (a JavaScript variant developed by Microsoft with enhanced data types), and Dart language, and other programming languages that can be compiled into JavaScript.
Node.js is mainly used to write network applications like web servers, which is similar to PHP and Python. But the biggest difference between Node.js and other languages is that languages such as PHP are blocking (the following commands will not be executed until the previous command is executed), while Node.js is non-blocking (multiple commands can be run at the same time) , knowing that the command has finished running through the callback function).
Node.js is event driven. Developers can develop a server that can handle high concurrency without using threads. It is difficult to develop high-concurrency applications with other server-side languages, and even if they are developed, the performance is not satisfactory. Node.js was created on this premise. Node.js combines the ease of learning and using JavaScript with the power of Unix network programming.
Node.js uses the Google V8 JavaScript engine because:
V8 is open source software based on the BSD license
V8 is very fast
V8 focuses on network functions and is more mature in aspects such as HTTP, DNS, TCP, etc.
Node.js already has numerous There are hundreds of thousands of modules, which can be downloaded for free through a manager called npm. The Node.js development community mainly has two mailing lists and an IRC channel called #node.js on freenode. The community is centralized at NodeConf.
Recommended learning: "nodejs video tutorial"
The above is the detailed content of What are the main functions of node js. For more information, please follow other related articles on the PHP Chinese website!