Form-data trouble

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)

}

Did you install body-parser?

something like this:

var bodyParser = require('body-parser');
var app = express();

// for parsing application/json
app.use(bodyParser.json());

Hey @lucaspieran :wave Welcome to Postman Community! :tada:

If your request is multipart/form-data, you would need to add:

const upload = multer()
app.use(upload.single('avatar')) //or app.use(upload.array())

in order to access text field data using req.body.

I found some useful info here: ExpressJS - Form data - Tutorialspoint
Hope this helps! :slightly_smiling_face: