I made a registration page using dva, using the fake interface of roadhogrc. The server can receive the POST request, but it can’t get req.body. What should I do? I’m so anxious. What should I do? It’s been a whole morning, can anyone help me aaaa...QAQ...
github link
[`POST /api/signin`](req,res){
const user = req.body;
console.log(user) //undefined
res.json('123')
}
I have been troubled by this problem for many days. Today I saw your question and the comments on the first floor and it suddenly clicked... The roadhog version that dva scaffolding relies on by default is 0.5.... Just update the roadhog version, npm i roadhog@0.6.0-beta.3 Remember to change the dependencies, I just tested it myself and it was successful
Have a cursory look at roadhog’s documentation. It says:
Since we are referring to express, let’s think it is express
Looking at the dependency, there is body.parser, so req.body should be available.
I tried the link you sent and it works. . . = =
Check the front end