How can I dynamically generate Html content with Node.js? [duplicate]

南楼画角 提交于 2020-01-03 21:04:51

问题


I understand how I can serve Html pages through Node.js to a client. Now I'm looking for a way to programatically generate Html on the server side (and then do whatever I want with it: save to a file, send to a client). Similiar to the way you'd do the same on the client side, with methods such as document.createElement or jQuery.

How can programatic Html generation be done with Node.js? (And I don't mean hardcoded Html writing to a file, of course).


回答1:


I think for your purpose reactjs might be the library to look at. It creates a virtual DOM node which is stateful and changes only on statechanges.

for serverside rendering this might be perfect for you! ;)



来源:https://stackoverflow.com/questions/28023829/how-can-i-dynamically-generate-html-content-with-node-js

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!