I am trying to send data through form-data in postman, since I have to upload images in the same model with multer but it does not work for me I think I am doing it wrong since e raw if everything is fine, and this is my controller that on progress
I send email and password as key in formdata
const crearUsuario = async (req = request, res = response) => {
const { email, password } = req.body
const usuario = new Usuario({ email, password });
//verificar si el correo existe
const existeEmail = await Usuario.findOne({ where: { email } });
if (existeEmail) {
return res.status(400).json({
msg: "Ya existe un usuario con ese email"
})
}
//hash password
const salt = bcrypt.genSaltSync();
usuario.password = bcrypt.hashSync(password, salt);
//guardar en db
await usuario.save();
res.status(200).json(usuario)
}