node.js - nodejs+express渲染页面
巴扎黑
巴扎黑 2017-04-17 13:33:32
0
2
566

想用node.js+express写网站,网站头部一样,首页没有footer,其他几页都有,那我这个网站视图要分几个文件,用户点击切换时如何渲染每个页面?

巴扎黑
巴扎黑

reply all(2)
洪涛

It depends on your needs, you can

头部 + 主体 + footer

or

头部 + footer

Use templates to configure required content, such as ejs, etc.

Or you can choose a single-page application and use routing to control rendering.

阿神

If you use ejs, make a header and footer file, and include the header and footer in each page as needed.
For example:

<%- include header %>
<!-- 主要内容区 -->
<%- include footer%>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template