Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the architecture of node

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the relevant knowledge of "what is the architecture of node". Xiaobian shows you the operation process through actual cases. The operation method is simple, fast and practical. I hope this article "what is the architecture of node" can help you solve the problem.

Node architecture is divided into three layers: 1, display layer, responsible for processing display;2, business logic layer, responsible for processing the data of the display layer, or obtain the data of the server for processing and return to the display layer;3, data access layer, responsible for calling data from the database.

Operating environment: Windows 10 system, nodejs version 12.19.0, Dell G3 computer.

What are the levels of node architecture?

A three-tier architecture literally means that values have three different layers of structure, each responsible for or handling different data. The three-layer architecture is in line with the idea of "high cohesion, low coupling." Someone asked what is high cohesion and what is low coupling.

high cohesion

The stronger the correlation, the higher the cohesion and the stronger the singleness of the module. A module should be as independent as possible to complete a certain function, if it is a low cohesive code module then maintenance is troublesome

low coupling

There are dependencies between modules, resulting in changes that may affect each other. The closer the relationship, the stronger the coupling, and the worse the module independence.

What are the three levels?

The three layers are presentation layer (display layer), business logic layer (data layer) and data access layer (persistence layer).

Presentation Layer (Display Layer)

As the name suggests, it is responsible for only handling the display layer. In nodejs, it is mainly responsible for receiving data from the page to the server and returning data.

Business Logic Layer (Data Layer)

The layer mainly responsible for processing data, that is, processing the data of the display layer, or obtaining the data of the server for processing and returning to the display layer.

Data Access Layer (Persistence Layer)

This layer is mainly responsible for calling from the database. This layer is to operate on the database, such as obtaining data, editing data, adding data, and deleting data.

Three-tier architecture in nodejs

If you want to carry out front-end separation development, you must use a three-tier architecture. For front-end engineers, you will not master too much about the background technology. It is good to use nodejs that front-end engineers are familiar with to develop.

In nodejs we will reference express to configure the background. The above only shows the three-tier architecture, probably not the specific files of the project.

Above our overall folder is divided into. So that's our three-tier architecture.

dao-data layer

db.js in the folder is what lets us connect to the server

And the model is specifically to access the server for operation

And xxxDao.js calls methods in the model layer to perform specific operations

After our data layer processes the data, the dao layer will return the obtained data or results to the service layer

service-data processing layer

service performs further processing and returns the processed data to router

ui layer (router)

ul layer renders data on the page html

The content of "node architecture" is introduced here. Thank you for reading it. If you want to know more about industry-related knowledge, you can pay attention to the industry information channel. Xiaobian will update different knowledge points for you every day.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report