Home > Web Front-end > Front-end Q&A > Does node count as a language?

Does node count as a language?

藏色散人
Release: 2021-12-10 11:49:41
Original
2720 people have browsed it

Node is not a language, node.js is an open source code, cross-platform execution environment that can run JavaScript on the server side; node.js uses the V8 execution code developed by Google, using event-driven, non-blocking and asynchronous Techniques such as input-output models to improve performance can optimize application transfer volume and scale.

Does node count as a language?

The operating environment of this article: Windows 7 system, nodejs version 10.16.2, Dell G3 computer.

Is node considered a language?

Node is not considered a language.

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!, Walmart, Groupon, SAP[13], LinkedIn, Rakuten, PayPal, Voxer[18], GoDaddy and other companies.

Main functions

The V8 engine itself uses some of the latest compilation technologies. This greatly improves the running speed of code written in scripting languages ​​​​such as Javascript and saves development costs. Demanding performance is a key factor in Node. Javascript is an event-driven language, and Node takes advantage of this to write a highly scalable server. Node uses an architecture called an "event loop" to make writing highly scalable servers easy and safe. There are a variety of techniques for improving server performance. Node has chosen an architecture that can both improve performance and reduce development complexity. This is a very important feature. Concurrent programming is often complex and full of landmines. Node bypasses these but still provides great performance.

Node uses a series of "non-blocking" libraries to support the event loop. Essentially, it provides interfaces for resources such as file systems and databases. When sending a request to the file system, there is no need to wait for the hard disk (to address and retrieve the file). The non-blocking interface will notify Node when the hard disk is ready. This model simplifies access to slow resources in a scalable way that is intuitive and easy to understand. Especially for users who are familiar with DOM events such as onmouseover and onclick, they will feel familiar.

Although letting Javascript run on the server side is not a unique feature of Node, it is one of its powerful features. We have to admit that the browser environment limits our freedom to choose programming languages. Any desire to share code between servers and increasingly complex browser client applications can only be achieved through Javascript. Although there are other platforms that support Javascript running on the server side, Node has developed rapidly and become the de facto platform because of the above characteristics.

In the short time since Node was launched, the community has contributed a large number of extension libraries (modules). Many of them are drivers for connecting to databases or other software, but many of them are very useful software produced by their capabilities.

Finally, I have to mention the Node community. Although the Node project is still very young, it is rare to see such a passionate community for a project. Whether you are a novice or an expert, everyone uses and contributes their abilities around the project, and is committed to creating a paradise for exploration, support, sharing, and listening to suggestions.

Program Example

HTTP Server version hello world example written in Node.js:

const http = require('http');
http.createServer((request, response) => {
  response.writeHead(200, { 'Content-Type': 'text/plain' });
  response.end('Hello World!');
}).listen(8000);
console.log('Server running at http://127.0.0.1:8000/');
Copy after login

Another simple TCP server example, listening ( Listening) port 7000 and output (echo) the previously entered message:

const net = require('net');
net.createServer(stream => {
  stream.write('hello\r\n');
  stream.on('end', () => stream.end('goodbye\r\n'));
  stream.pipe(stream);
}).listen(7000);
Copy after login

Recommended learning: "node.js Video Tutorial"

The above is the detailed content of Does node count as a language?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template