You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
req.body is always empty if you submit form (POST) via the html way , because in your files settings each route, you call express.Router() before settings bodyparser.
The text was updated successfully, but these errors were encountered:
I don't understand what you are trying to say. Please clarify what doesn't work or what you are trying to do. Valid app code we can run and see fail would be helpful.
/* GET users listing. */router.get('/',function(req,res){res.render('users');});router.post('/',function(req,res){console.log(req.body.userName);res.end();});
console.log should return a value, you instantiate Router when you require your routes files, you do this before 'bodyparser'. That's why console.log(req.body.name) return 'undefined'.
This issue still makes no sense to me and I don't see what changes need to happen. If you make a PR I can review that, but based on the description I don't see a problem (looking at the current generator code).
if you do this :
req.body is always empty if you submit form (POST) via the html way , because in your files settings each route, you call
express.Router()
before settingsbodyparser
.The text was updated successfully, but these errors were encountered: