Questions about nodejs as Intermediate Layer

  node.js, question

It was not long before I started learning the front end. I wanted to use nodejs to write a project to practice my hands.And want to simulate the complex system as much as possible

Suppose I have three separate parts,

  1. Browser-side development capability (css,js)

  2. Server-side Development Capability (nodejs)

  3. Database side development capability (mySQL) (assuming python)

Try to let these three parts develop their own parts independently, so the database part is separated from nodejs inside. nodejs only serves as a server to realize routing and provide static file functions. I think this is probably the advantage of this model.
This scheme is used by others when I look up data on the Internet. nodejs is the middle layer and python is the source of background data.
The projects I have written before are all done in a single language behind the scenes, using frameworks to integrate static files and connect databases, such as python’s flask and nodejs’s express Framework * *

Now there are two doubts
1.现在服务端这里nodejs和数据库分离,想问下具体如何实现?For example, if a user clicks a button and the browser ajax requests nodejs for a route /showdata, then this route should access the database to retrieve the data and return it to the browser in json format. I don’t quite understand how python, as the background, provides an interface for nodejs to directly access. py scripts. Or is there a python program running on the server? I hope to get an answer as detailed as possible.
2. This mode is equivalent to one more layer of data communication. Will the speed be faster?Can the speed advantage brought by using java or other languages in the background make up for the delay brought by this extra layer of communication? Or is it simply because separation facilitates independent development?

  1. Python provides http interface for nodejs.

  2. The speed will be slower than that of Diu Diu, but the responsibilities will be clearer.

The advantage of doing so is that

1. One Server side (Python) can serve multiple Client sides (Node|iOS|Android).
2. One end can change the implementation code at will. As long as the http interface is the same, for example, if the back end wants to change java one day and writes Interface testing directly, the front end does not need to be notified.

Can be structured like this

Python is responsible for data access.
Node is responsible for page rendering and user rights verification.