0
Follow
5
View

express-session with mongo-store - Headers already sent in req.session.save() callback

yihui_80 注册会员
2023-01-26 11:01

Seems like you are missing async and await. Can you share complete method code?

 const saveInSession =  async (req, res, next) => {
    const getData = await req.body; //just an example
    req.session.save((err) => {
           if (err) {
               console.log('Error saving session: ', err);
           } else {
               // res.json({ data: 'Hello CB' }); //Headers already sent
           }
       });
  };

About the Author

Question Info

Publish Time
2023-01-26 11:01
Update Time
2023-01-26 11:01

Related Question

PIL Image with mode 1

在with语句中返回生成器

Require a password but *not* a username to access web page with apache

为什么Withspinner加载图标不能在动作按钮触发器上工作?

构建失败:未找到SDK位置(:app:compileDebugJavaWithJavac)

How to retrieve the host name by IP with dnsjava library?

How edit products without forms.py Django?

AWS AppSync unauthenticated access WITHOUT Amplify

react,账号登陆模块使用withFormik报错的问题

什么时候应该使用Link with Qt?