nodejs express 服务器发送带有依赖项的 html 文件

问题描述

如果我打开本地主机,我的 html 会加载,但不会加载我的 css 和框架源等依赖项。我该如何解决。我搜索了它,但找不到任何对我有用的东西。 并且 nvs 文件也有自己的依赖项。

我的 JS_FILE

const express = require('express');
const app = express();
const port = 4545;
const path = require('path');

app.get('/',(req,res) => {
    res.sendFile('index.html',{ root: path.join(__dirname,'/html/') })
})

html:

<!DOCTYPE html>
<html>

<head>
    <Meta charset="utf-8" />
    <link rel="stylesheet" type="text/css" href="style.css" media="screen" />
</head>

<frameset rows="10%,85%,5%" FRAMEBORDER="0" FRAMEBORDER="NO" BORDER="0">
    <frame name="top" src="top.html" noresize="noresize" />
    <frameset cols="30%,70%" FRAMEBORDER="0" FRAMEBORDER="NO" BORDER="0">
        <frame name="nvs" src="nvs.html" noresize="noresize" />
        <frameset rows="50%,50%" FRAMEBORDER="0" FRAMEBORDER="NO" BORDER="0">
            <frame name="nvs" src="nvs.html" noresize="noresize" />
            <frame name="nvs" src="nvs.html" noresize="noresize" />
        </frameset>
    </frameset>
    <frame name="bottom" src="footer.html" />
    <noframes>

        <body>Your browser does not support frames.</body>
    </noframes>

</frameset>

</html>

</html>

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)