gpt4 book ai didi

node.js - 如何在 Node 中链接页面

转载 作者:行者123 更新时间:2023-12-02 04:12:47 25 4
gpt4 key购买 nike

我有一个页面index.html,当我运行app.js时加载,在App.js中我有:

app.get('/branch', function (req, res,html) {
res.render('/reacted/branch.html');
});

我有 <li>
<a href="branch.html"><i class="fa fa-fw fa-table"></i> Branches</a>
</li>
当我单击菜单上的“分支”时,我希望渲染branch.html

最佳答案

我只需要在我的 html 文件中执行此操作:

<a href="/branch"><i class="fa fa-fw fa-table"></i> Branches</a>

在 js 文件中:

app.get('/branch', function (req, res,html) {
res.sendFile(path.join(__dirname+'/branch.html'));
});

关于node.js - 如何在 Node 中链接页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35744597/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com