Express.js POST req.body empty

后端 未结 4 679
北海茫月
北海茫月 2020-12-06 18:34

So I have the following code in my server.js file that I\'m running with node.js. I\'m using express to handle HTTP requests.

app.post(\'/api/destinations\',         


        
4条回答
  •  [愿得一人]
    2020-12-06 18:55

    Sometimes the req.body shows {} if you forgot to put the name attribute to the form input fields. Following is an example:

    
    

    Then the req.body shows { myemail: 'mathewjohnxxxx@gmail.com' }

    I post this answer because, i have encountered the similar problem and this worked for me.

提交回复
热议问题