开发者

Generate HTML or load it in nodejs world?

开发者 https://www.devze.com 2023-01-23 02:36 出处:网络
I\'m new to the nodejs world, a noob question for you: We use haml, ejs, ... to generate HTML files. Can we load our own HTML file like normal? Which way is more e开发者_C百科fficienct?

I'm new to the nodejs world, a noob question for you: We use haml, ejs, ... to generate HTML files. Can we load our own HTML file like normal? Which way is more e开发者_C百科fficienct?

Note: I think I'm asking a bad question here but it's the way to understand things clearly :)


Most node.js web framework also couple as web servers and are capable of serving plain static HTML files.

Grasshopper is a framework I wrote which handles this. There are even dedicated static file servers for node.js like Paperboy.


If you are serving a plain static HTML page, then you should go with loading the HTML files directly.

but if you are creating dynamic pages, whose content depends on some business logic, then you should use template engines like pub, ejs, haml. most of the web frameworks allow the content to be served from plain HTML files as well as template engines.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号