我需要Node.js中的帮助

问题描述

我需要帮助。我不知道为什么 push users 数组发送对象谢谢您的帮助。

                const users = [];
    
                app.post('/register',urlencodedParser,async (req,res) => {
                    try {
                      const hashedPassword = await bcrypt.hash(req.body.password,10)
                      users.push({
                        id: Date.now().toString(),name: req.body.username,email: req.body.email,password: hashedPassword
                      })
                      res.redirect('/login')
                    } catch {
                      res.redirect('/register')
                    }
                    console.log(users)**
                  })

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)