javascript - Nodejs使用静态路由
问题描述
在我的项目中,我有一个结构:
-- Development
---allure
----allure-report
-----index.html
---testcafe (running app folder)
----routes
-----test.js
----views
-----report.ejs
----package.json
----app.js
现在我想在我的浏览器中显示 index.html。为此,我使用:
app.use(express.static(path.join(__basedir , '../allure/allure-report/')))
这将创建“/development/allure/allure-report/”文件夹的路径。
现在我在 report.ejs 中使用模板:
<div class="iframe-container">
<iframe src="index.html" allowfullscreen></iframe>
</div>
但这会产生 404 错误。在我的想法中,这将呈现 index.html。这不起作用。这是错误的方式吗?
解决方案
推荐阅读
- c# - 使用 distinct 删除重复项
- php - 在 PHP 中加入 MySQL 较高的 LIMIT 偏移非常慢
- c++ - 通过交换元素使数组相同
- css - 父 ul 的绝对位置停止在 IE 中工作的锚链接
- node.js - 使用 vue/cli 运行 npm run serve 时出现问题
- c# - 从 .net core 2.1 与 .net core 3.0 调用时的 StreamWriter 类行为
- reactjs - 我在 apache2 服务器上本地运行一个反应应用程序。它给出了在此服务器上找不到错误 URL
- wpf - UWP App WPF .Net Core 对依赖没有访问权限
- regex - 删除文本文件中的转义 unicode 序列
- tensorflow - 如何使用带有 Inception-Resnet 无头模型的传输学习来提高模型精度?