Skip to content Skip to sidebar Skip to footer

Req.body Not Populating With Form Data

The following files are my attempt at submitting a POST request to my nodejs (express) server. The req.body does not populate any sort of data from my form. I have done many sear

Solution 1:

You're using the wrong enctype for the form, express by default does not support multipart ( which is used for file uploads ), you need to use x-www-form-urlencoded.

form(method='post', action='/signup', enctype='application/x-www-form-urlencoded')

Solution 2:

You're sending a multipart/form-data request but you're not using a multipart/form-data-compatible body parsing middleware. Some example middleware modules that do handle that format are multer and multiparty/formidable.

Post a Comment for "Req.body Not Populating With Form Data"