Home Web Front-end JS Tutorial What does nodejs do?

What does nodejs do?

Sep 01, 2021 am 11:52 AM
nodejs

nodejs is an open source, cross-platform running environment that can run JavaScript on the server side; Node.js uses the V8 running code developed by Google and uses technologies such as event-driven, non-blocking and asynchronous input and output models to improve Performance, optimizing application transfer volume and scale.

What does nodejs do?

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

What does nodejs do?

Node.js is an open source, cross-platform operating 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 running 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 often ran 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 run as a standalone server without Apache HTTP Server or IIS.

nodejs introduction:

Node.js is a very hot technology at present, but its birth experience is very strange.

As we all know, in just a few months after Netscape designed JavaScript, JavaScript was actually the only standard for front-end development.

Later, Microsoft defeated Netscape through IE and unified the desktop. As a result, the browser made no progress in a few years. (The ancient IE 6 launched in 2001 is still used by people today!)

There will be no development without competition. Microsoft believed that the IE6 browser was already very complete and had almost no room for improvement, so it disbanded the IE6 development team! However, Google believes that the new generation of browsers that support modern web applications has just begun, especially the performance of the browser's engine responsible for running JavaScript can be improved by 10 times.

First, Mozilla launched the Firefox browser in 2002 with the help of the legacy of Netscape, which had sacrificed its life. Then in 2003, Apple launched the Safari browser with WebKit core based on the open source KHTML browser, but only Limited to Mac platform.

Subsequently, Google also began to create its own browser. They also took a fancy to the WebKit core, so they launched the Chrome browser based on the WebKit core.

The Chrome browser works across Windows and Mac platforms, and Google believes that to run modern web applications, the browser must have a very powerful JavaScript engine, so Google developed a high-performance JavaScript engine. The name is V8, and it is open source under the BSD license.

The modern browser war has left Microsoft's IE browser far behind because they disbanded the most experienced and most powerful browser team! Looking back and catching up, I found that WebKit supporting HTML5 has become a standard on mobile phones, and IE browser has since been isolated from mainstream mobile devices.

What does the browser war have to do with Node?

There is a guy named Ryan Dahl. His job is to write high-performance web services using C/C. For high performance, asynchronous IO and event-driven are the basic principles, but writing in C/C is too painful. So this friend began to imagine using high-level languages ​​to develop Web services. He evaluated many high-level languages ​​and found that although many languages ​​​​provide both synchronous IO and asynchronous IO, once developers use synchronous IO, they are no longer too lazy to write asynchronous IO, so in the end, Ryan aimed at JavaScript.

Because JavaScript is executed in a single thread and cannot perform synchronous IO operations at all, this "defect" of JavaScript causes it to only use asynchronous IO.

The development language is selected, and a runtime engine is also required. This guy once considered writing one himself, but wisely gave up because V8 is an open source JavaScript engine. Let Google invest in optimizing V8, and we will only modify it for use without having to pay. This is a very cost-effective deal.

So in 2009, Ryan officially launched an open source web server project based on JavaScript language and V8 engine, named Node.js. Although the name is very tacky, Node brought JavaScript to back-end server development for the first time, and there were already countless JavaScript developers in the world, so Node became popular all of a sudden.

What are the advantages of JavaScript running on Node compared to other back-end development languages?

The biggest advantage is that with the help of JavaScript's natural event-driven mechanism and V8 high-performance engine, it is easy to write high-performance Web services.

Secondly, the JavaScript language itself is a complete functional language. During front-end development, developers often write more casually, making people feel that JavaScript is a "toy language". However, in the Node environment, through modular JavaScript code, functional programming, and without considering browser compatibility issues, the latest ECMAScript 6 standard can be directly used to fully meet engineering needs.

I have also heard of io.js, what the hell is this?

Because Node.js is an open source project, although it is driven by the community, it has always been funded by Joyent behind the scenes. Because a group of developers were dissatisfied with Joyent's strategy, they forked the io.js project from the Node.js project in 2014 and decided to develop it separately, but the two are actually compatible.

However, there is an old saying in China, which is called "If we divide for a long time, we must unite; if we unite for a long time, we must divide." Not long after the separation, Joyent said it wanted to reconcile, so the io.js project decided to return to Node.js.

The specific approach is that in the future, io.js will first add new features. If everyone is happy with the test, the new features will be added to Node.js. io.js is the "early adopter version", while Node.js is the online stable version, which is equivalent to the relationship between Fedora Linux and RHEL.

Recommended learning: "nodejs video tutorial"

The above is the detailed content of What does nodejs do?. For more information, please follow other related articles on the PHP Chinese website!

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

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What is the difference between npm and npm.cmd files in the nodejs installation directory? What is the difference between npm and npm.cmd files in the nodejs installation directory? Apr 21, 2024 am 05:18 AM

There are two npm-related files in the Node.js installation directory: npm and npm.cmd. The differences are as follows: different extensions: npm is an executable file, and npm.cmd is a command window shortcut. Windows users: npm.cmd can be used from the command prompt, npm can only be run from the command line. Compatibility: npm.cmd is specific to Windows systems, npm is available cross-platform. Usage recommendations: Windows users use npm.cmd, other operating systems use npm.

Is nodejs a backend framework? Is nodejs a backend framework? Apr 21, 2024 am 05:09 AM

Node.js can be used as a backend framework as it offers features such as high performance, scalability, cross-platform support, rich ecosystem, and ease of development.

Can nodejs write front-end? Can nodejs write front-end? Apr 21, 2024 am 05:00 AM

Yes, Node.js can be used for front-end development, and key advantages include high performance, rich ecosystem, and cross-platform compatibility. Considerations to consider are learning curve, tool support, and small community size.

What are the global variables in nodejs What are the global variables in nodejs Apr 21, 2024 am 04:54 AM

The following global variables exist in Node.js: Global object: global Core module: process, console, require Runtime environment variables: __dirname, __filename, __line, __column Constants: undefined, null, NaN, Infinity, -Infinity

Is nodejs a back-end development language? Is nodejs a back-end development language? Apr 21, 2024 am 05:09 AM

Yes, Node.js is a backend development language. It is used for back-end development, including handling server-side business logic, managing database connections, and providing APIs.

How to connect nodejs to mysql database How to connect nodejs to mysql database Apr 21, 2024 am 06:13 AM

To connect to a MySQL database, you need to follow these steps: Install the mysql2 driver. Use mysql2.createConnection() to create a connection object that contains the host address, port, username, password, and database name. Use connection.query() to perform queries. Finally use connection.end() to end the connection.

What projects is nodejs suitable for? What projects is nodejs suitable for? Apr 21, 2024 am 05:45 AM

Node.js is suitable for the following project types: Network and server applications Event-driven applications Real-time applications Data-intensive applications Command-line tools and scripts Lightweight microservices

How to deploy nodejs project to server How to deploy nodejs project to server Apr 21, 2024 am 04:40 AM

Server deployment steps for a Node.js project: Prepare the deployment environment: obtain server access, install Node.js, set up a Git repository. Build the application: Use npm run build to generate deployable code and dependencies. Upload code to the server: via Git or File Transfer Protocol. Install dependencies: SSH into the server and use npm install to install application dependencies. Start the application: Use a command such as node index.js to start the application, or use a process manager such as pm2. Configure a reverse proxy (optional): Use a reverse proxy such as Nginx or Apache to route traffic to your application

See all articles