【发布时间】:2021-07-30 20:26:45
【问题描述】:
目前我正在使用 node/express/hbs 和 mysql 制作通知系统。我可以正确地向数据库插入通知,但我无法获取我的部分文件。
这是我的代码
countNotification: async (req, res) => {
await Notification.count({ where: { status: 'unread' } }).then((notification) => {
if (notification) {
const dashNotification = req.notification;
return dashNotification;
}
});
},
app.use((req, res, next) => {
res.locals.user = req.user;
res.locals.notification = req.dashNotification;
next();
});
我试过这样,但它不起作用,有人有任何解决方案吗?
【问题讨论】:
标签: node.js express session notifications