Error: se requieren datos y argumentos salt en Object.hash (D:\social-media\rest-api\node_modules\bcrypt\bcrypt.js:137:17) en D:\social-media\rest-api\node_modules\bcrypt \promises.js:29:12 en new Promise () en Object.module.exports.promise (D:\social-media\rest-api\node_modules\bcrypt\promises.js:20:12) en Object.hash ( D:\social-media\rest-api\node_modules\bcrypt\bcrypt.js:133:25) en D:\social-media\rest-api\routes\auth.js:8:45
const router = require("express").Router(); const User = require("../models/Users"); const bcrypt = require("bcrypt"); router.post("/register", async (req, res) => { try { const salt = await bcrypt.genSalt(10); const hashedPassword = await bcrypt.hash(req.body.password, salt); const newUser = new User({ username: req.body.username, email: req.body.email, password: hashedPassword }); const user = await newUser.save(); res.status(200).json(user); } catch (err) { console.log(err) } }); router.get("/register", (req, res) => { res.send("runing"); }); module.exports = router;¿Qué tal si solo usamos const en bcypt.hash
const hashedPassword = await bcrypt.hash(req.body.password, 10)