我无法渲染我的EJS文件。选项卡只是加载和加载。一旦我停止了Nodemon,它就会渲染
我正在app.get(“/user/:u_id)
app.get("/user/:U_ID", function(req, res) {
console.log(req.params.U_ID);
User.find({_id: req.params.U_ID}, function(err, foundList) {
if(!err) {
if(foundList) {
console.log(foundList);
res.render("dashboard.ejs", {user: foundList[0]});
}
} else {
// alert("Something went wrong");
res.redirect("/");
}
});
});
。 中找到用户后,我想渲染的EJS。
从数据库 和我的Chrome Tab
当它到达res.render(...)
的线时,它只是开始加载,加载和加载。 当我停止我的Nodemon
或再次使用App.js
使用ctrl+S
,Nodemon
再次保存app.js
重新启动服务器,然后将我的dashboard.ejs
渲染。
请帮助。如何渲染dashboard.ejs
。
I am searching for a particular user in app.get("/user/:U_ID)
. Below is the code for it.
app.get("/user/:U_ID", function(req, res) {
console.log(req.params.U_ID);
User.find({_id: req.params.U_ID}, function(err, foundList) {
if(!err) {
if(foundList) {
console.log(foundList);
res.render("dashboard.ejs", {user: foundList[0]});
}
} else {
// alert("Something went wrong");
res.redirect("/");
}
});
});
I am finding that user too in my database. But I am not able to render the ejs that I want to render after finding the user from database.
Here is the code, its output in console and my chrome tab
When it reaches to the line of res.render(...)
, it just starts to load, load and load.
When I am stopping my nodemon
or I am again saving the app.js
with CTRL+S
, nodemon
again restarts the server, then my dashboard.ejs
gets rendered.
Please help. How to render the dashboard.ejs
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论