Home Web Front-end JS Tutorial What does node.js do? Introduction to 10 application scenarios of node.js

What does node.js do? Introduction to 10 application scenarios of node.js

Sep 05, 2018 pm 02:31 PM
js node.js

This article mainly introduces the definition and description of node.js, as well as ten application scenarios of node.js, letting everyone know where node.js can be applied. Now let’s take a look at this article Article

First we need to know what node.js is?

1. What is Node.js (actually, it is about learning web server development)

1. It is a JS runtime environment (in simple terms, it can Parse and execute js code): not a language/library/framework

(1) JavaScript in Node.js does not have BOM or DOM, only EcmaScript (basic syntax), because the server does not operate the page

(2) In the Node javascript execution environment, some server-level operation APIs are provided for js (file reading and writing, building network services, network communication, http server, etc.)

2. Features: Use event-driven, non-blocking IO model (simply speaking, asynchronous), lightweight and efficient

3. Most JS-related packages are placed on npm

For example: With npm After that, one command can be issued to different libraries/frameworks (such as jquery), without having to go to the official website of each library/framework to download

2. What can Node.js do

1.Web server backend (node.js made of java and php can be used)

2.Command line tool

Note 1: BS programming of any server-side technology The models are all the same, regardless of language

Note 2: Node does not have html files, only .js files

Now count the 10 application scenarios of node.js:

1. Web development: Express EJS Mongoose/MySQL

express is a lightweight and flexible Nodejs Web application framework that can quickly build a website. The Express framework is built on the built-in Http module of Nodejs and repackages the Http module to implement the function of Web request processing.

ejs is an embedded Javascript template engine that generates HTML code through compilation.

mongoose is the object model tool of MongoDB. Through the Mongoose framework, you can access MongoDB.

mysql is a communication API that connects to the MySQL database and can be used to access MySQL.

Usually using Nodejs for web development requires the use of three frameworks, just like SSH in Java.

2.REST development: Restify

restify is a REST application framework based on Nodejs, supporting server and client. Restify focuses more on REST services than express, removing the template, render and other functions in express. At the same time, it strengthens the use of REST protocol, versioning support, and HTTP exception handling.

3. Web chat room (IM): Express Socket.io

socket.io is based on the Nodejs architecture system and supports the websocket protocol for real-time communication. of a software package. Socket.io provides a complete package for building real-time applications across browsers. Socket.io is completely implemented by JavaScript.

4Web crawler: Cheerio/Request

cheerio is a fast, flexible and encapsulating jQuery core function toolkit specially customized for the server. Cheerio includes a subset of core jQuery, stripping away all DOM inconsistencies and browser incompatibilities from the jQuery library, revealing its truly elegant API. Cheerio works on a very simple, consistent DOM model, making parsing, manipulation, and rendering incredibly efficient. Basic end-to-end benchmarks show that Cheerio is approximately eight times (8x) faster than JSDOM. Cheerio encapsulates the @FB55 compatible htmlparser and can parse almost any HTML and XML document.

5. Web blog: Hexo

Hexo is a simple, lightweight, static blog framework based on Node. Through Hexo, we can quickly create our own blog, which can be completed with only a few commands.

When released, Hexo can be deployed on your own Node server or on github. For individual users, deploying on GitHub has many benefits. It can not only save the cost of servers, but also reduce the troubles of various system operation and maintenance (system management, backup, network). Therefore, personal sites based on github are beginning to become popular...

6.Web Forum: nodeclub

Node Club is a new type developed with Node.js and MongoDB Community software has an elegant interface, rich functions, small size and speed. It has been used in the Node.js Chinese technical community CNode, but you can use it to build your own community.

7. Web Slideshow: Cleaver

Cleaver can generate presentations based on Markdown. If you already have a Markdown document, you can create a slideshow in 30 seconds. Cleaver is a tool for Hackers.

8. Front-end package management platform: bower.js

Bower is a package management tool launched by Twitter. It is based on the modular idea of ​​nodejs and disperses functions into In each module, there is a connection between modules, and Bower is used to manage this connection between modules.

9.OAuth authentication: Passport

The Passport project is an authentication middleware based on Nodejs. The purpose of Passport is only for "login authentication". Therefore, the code is clean, easy to maintain, and can be easily integrated into other applications. Web applications generally have two forms of login authentication: username and password authentication login, and OAuth authentication login. Passport can configure different authentication mechanisms according to the characteristics of the application. This article will introduce the authentication login of user name and password.

10. Scheduled task tool: later

Later is a tool library based on Nodejs that performs scheduled tasks in the simplest way. Later can run in Node and the browser.

The above is the introduction of node.js in this article and the introduction of ten application scenarios. Students who want to learn node.js can go to the PHP Chinese websiteNode.js Learning Manual

[Editor’s Recommendation]

How to set up the html search box? Examples of how to use the input tag in the html search box

html How to use the base tag? Summary of usage of html base tag

The above is the detailed content of What does node.js do? Introduction to 10 application scenarios of node.js. 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

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.

Undress AI Tool

Undress AI Tool

Undress images for free

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)

Recommended: Excellent JS open source face detection and recognition project Recommended: Excellent JS open source face detection and recognition project Apr 03, 2024 am 11:55 AM

Face detection and recognition technology is already a relatively mature and widely used technology. Currently, the most widely used Internet application language is JS. Implementing face detection and recognition on the Web front-end has advantages and disadvantages compared to back-end face recognition. Advantages include reducing network interaction and real-time recognition, which greatly shortens user waiting time and improves user experience; disadvantages include: being limited by model size, the accuracy is also limited. How to use js to implement face detection on the web? In order to implement face recognition on the Web, you need to be familiar with related programming languages ​​and technologies, such as JavaScript, HTML, CSS, WebRTC, etc. At the same time, you also need to master relevant computer vision and artificial intelligence technologies. It is worth noting that due to the design of the Web side

How to use JS and Baidu Maps to implement map pan function How to use JS and Baidu Maps to implement map pan function Nov 21, 2023 am 10:00 AM

How to use JS and Baidu Map to implement map pan function Baidu Map is a widely used map service platform, which is often used in web development to display geographical information, positioning and other functions. This article will introduce how to use JS and Baidu Map API to implement the map pan function, and provide specific code examples. 1. Preparation Before using Baidu Map API, you first need to apply for a developer account on Baidu Map Open Platform (http://lbsyun.baidu.com/) and create an application. Creation completed

Essential tools for stock analysis: Learn the steps to draw candle charts with PHP and JS Essential tools for stock analysis: Learn the steps to draw candle charts with PHP and JS Dec 17, 2023 pm 06:55 PM

Essential tools for stock analysis: Learn the steps to draw candle charts in PHP and JS. Specific code examples are required. With the rapid development of the Internet and technology, stock trading has become one of the important ways for many investors. Stock analysis is an important part of investor decision-making, and candle charts are widely used in technical analysis. Learning how to draw candle charts using PHP and JS will provide investors with more intuitive information to help them make better decisions. A candlestick chart is a technical chart that displays stock prices in the form of candlesticks. It shows the stock price

How to create a stock candlestick chart using PHP and JS How to create a stock candlestick chart using PHP and JS Dec 17, 2023 am 08:08 AM

How to use PHP and JS to create a stock candle chart. A stock candle chart is a common technical analysis graphic in the stock market. It helps investors understand stocks more intuitively by drawing data such as the opening price, closing price, highest price and lowest price of the stock. price fluctuations. This article will teach you how to create stock candle charts using PHP and JS, with specific code examples. 1. Preparation Before starting, we need to prepare the following environment: 1. A server running PHP 2. A browser that supports HTML5 and Canvas 3

How to use JS and Baidu Map to implement map click event processing function How to use JS and Baidu Map to implement map click event processing function Nov 21, 2023 am 11:11 AM

Overview of how to use JS and Baidu Maps to implement map click event processing: In web development, it is often necessary to use map functions to display geographical location and geographical information. Click event processing on the map is a commonly used and important part of the map function. This article will introduce how to use JS and Baidu Map API to implement the click event processing function of the map, and give specific code examples. Steps: Import the API file of Baidu Map. First, import the file of Baidu Map API in the HTML file. This can be achieved through the following code:

How to use JS and Baidu Maps to implement map heat map function How to use JS and Baidu Maps to implement map heat map function Nov 21, 2023 am 09:33 AM

How to use JS and Baidu Maps to implement the map heat map function Introduction: With the rapid development of the Internet and mobile devices, maps have become a common application scenario. As a visual display method, heat maps can help us understand the distribution of data more intuitively. This article will introduce how to use JS and Baidu Map API to implement the map heat map function, and provide specific code examples. Preparation work: Before starting, you need to prepare the following items: a Baidu developer account, create an application, and obtain the corresponding AP

PHP and JS Development Tips: Master the Method of Drawing Stock Candle Charts PHP and JS Development Tips: Master the Method of Drawing Stock Candle Charts Dec 18, 2023 pm 03:39 PM

With the rapid development of Internet finance, stock investment has become the choice of more and more people. In stock trading, candle charts are a commonly used technical analysis method. It can show the changing trend of stock prices and help investors make more accurate decisions. This article will introduce the development skills of PHP and JS, lead readers to understand how to draw stock candle charts, and provide specific code examples. 1. Understanding Stock Candle Charts Before introducing how to draw stock candle charts, we first need to understand what a candle chart is. Candlestick charts were developed by the Japanese

The relationship between js and vue The relationship between js and vue Mar 11, 2024 pm 05:21 PM

The relationship between js and vue: 1. JS as the cornerstone of Web development; 2. The rise of Vue.js as a front-end framework; 3. The complementary relationship between JS and Vue; 4. The practical application of JS and Vue.

See all articles