Node.js 如何从hbs分配index.js文件中存在的路由?
我想将“视图”文件夹下定义为myprofile.hbs的“注销”菜单项引用到index.js中定义的路由/注销 我尝试将路径粘贴到该文件的a href=中 //显示内部视图/myprofile.hbsNode.js 如何从hbs分配index.js文件中存在的路由?,node.js,express,handlebars.js,Node.js,Express,Handlebars.js,我想将“视图”文件夹下定义为myprofile.hbs的“注销”菜单项引用到index.js中定义的路由/注销 我尝试将路径粘贴到该文件的a href=中 //显示内部视图/myprofile.hbs <li> <a href="./index.js/logout"> <i class="glyphicon glyphicon-log-out" id="signout"></i> Sign Out </a> </li> 假
<li>
<a href="./index.js/logout">
<i class="glyphicon glyphicon-log-out" id="signout"></i>
Sign Out </a>
</li>
假设上面的app.get位于应用程序的根目录下,则href只需为/logout
哦,thanx,太简单了,我不知道我被困在哪里了。哈哈
app.get("/logout",function(req,res){
req.session.destroy();
res.redirect("/");
});
<a href="/logout">
app.get("/logout"), . . .