小编Man*_*Kb 的帖子

使用nodejs Express渲染带有数据的html

我是新来的表达框架我只是想知道如何使用来自mongo DB的一些数据来渲染html页面我使用下面的代码发送html但不知道如何发送一些数据

res.sendFile(path + "feature.html"); this is success as html get renders 
Run Code Online (Sandbox Code Playgroud)

像这样发送数据?

res.sendFile(path + "feature.html", {data: data});
Run Code Online (Sandbox Code Playgroud)

如何在html中显示数据?如果我发送了这样的数组

res.sendFile(path + "feature.html", {data: []});
Run Code Online (Sandbox Code Playgroud)

如何在html中循环这个?

html javascript mongodb node.js express

0
推荐指数
1
解决办法
9572
查看次数

标签 统计

express ×1

html ×1

javascript ×1

mongodb ×1

node.js ×1