I want to request the interface data in nodeJs and then render it with ejs, so that when the browser requests it, the front-end page will be the rendered page. How to do this? (This seems to be a step towards separating the front and back ends)
我想大声告诉你2017-06-13 09:25:57
Using the EJS template engine does not require requesting the interface, it is directly rendered, and the backend directly transmits the output
//JS:
res.render('home', //这是你EJS模板页面的名称
{title: 'home'});
//html取值:
<%=title %>