req.body not populating with form data

前端 未结 2 706
栀梦
栀梦 2021-01-20 04:11

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 ma

相关标签:
2条回答
  • 2021-01-20 04:54

    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')
    
    0 讨论(0)
  • 2021-01-20 05:11

    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.

    0 讨论(0)
提交回复
热议问题