How does nodejs get the database data rendering page?

  node.js, question

Ask developers who understand nodejs,I want to build a website with Nodejs and express4. Now I need to read mysql data and transfer the data to the front-end html page (such as my homepage index.html). The question is how do I transfer the data to the front-end html? If you want to use templates, how do you want to use them? It is still necessary to use ajax to request data to be returned and displayed on the page, but there is a lot of data in the database.Some data are not what I want.

Templates can be used or not
1) Without using templates, the front end obtains data through ajax requests, and then renders the data at the front end.
2) Use the template, read the data of the database at nodejs end, pass it into the template, render it at the back end, and then output it to the front end.

All the data obtained from the database need to be processed into a data format that meets the business requirements in the background. It is inappropriate to directly return the data from the database to the front end.