Wednesday, 5 September 2018

Post from frontend to node is undefined

Hello, I am trying to read input value from form in my web (method POST, action /send), but when I send input value to Node server, the value is undefined.I setapp.use(bodyParser.urlencoded({ extended: true })) app.use(bodyParser.json()) in the begginning and thenapp.post('/send', (req, res) => { let msg = res.body.sending let msg2 = res.body console.log(msg) console.log("msg2") }) but nothing works. app.get from server to browser works just fine. It is probably some stupid mistake, but I can't find what exactly. Could you please help me? Thank you

Submitted September 05, 2018 at 09:36AM by mikebun2

No comments:

Post a Comment