【发布时间】:2019-01-21 11:59:15
【问题描述】:
我正在使用 Nodejs 和 Express 创建动态网页。
我有一个包含此 iframe 的 home.ejs 文件:
<iframe id="newstable" src="/news_tables/2018-08-04.html" height="1000" width="100%"></iframe>
我的文件夹目录是:
News_Aggregator (includes app.js)
News_Aggregator/news_tables (includes a bunch of html files, e.g. `2018-08-04.html`)
News_Aggregator/views (includes my `home.ejs` file)
还有我的app.js:
const express = require('express');
const app = express();
app.set("view engine", "ejs");
app.get('/', function(req, res){
res.render('home.ejs');
});
app.listen(8000, () => {
console.log('Example app listening on port 8000!')
});
但是,当 home.ejs 被渲染时,我的 iframe 不会加载 html 页面:
这适用于“普通”HTML。要让.ejs 文件找到并正确呈现,我缺少什么?
【问题讨论】:
标签: javascript node.js express ejs