How does the native node output the page? Can I output pages like php templates? Or do you use a method like readFile to get the contents of the file and then output it?

  node.js, question

For example, Baidu has such things as ejs, but it doesn’t know how to use them.

In fact, don’t understand nodejs so complicated.
Nodejs is to allow developers to use js to asynchronously read files and operate socket connections.
On top of this, some libraries dealing with network connections are officially packaged so that nodejs can be used as a web server.
When a user sends a request to the nodejs server, nodejs can return any content to the user.

As for what content, it is up to the developer to decide.
You can read the local file and return its contents to the user.
You can also grab the contents of other URLs and return them.
Ejs these things are templates, which you can understand to be similar to php. (php was the language used to process templates at the beginning, but later people added many functions to it, making it possible to do more than template processing. )