I'm new in all this, so please understand me. I trying to send data from HTML page (made with Google Cloud Shell) to Node.js page (made with Google Functions) but when I use the command console.log(req.body), I always see in the logs undefined. Here is the code
HTML :
<form action="link" method="post">
ID : <input type="text" id="demo3" name="id"><br>
<br>
Nome : <input type="text" id="demo" name="fname"><br>
<br>
Cognome : <input type="text" id="demo1" name="lname"><br>
<br>
Età : <input type="text" id="demo2" name="eta"><br>
<br>
<input type="submit" value="Submit">
</form>
Blockquote
Node.js :
exports.helloWorld = (req, res) => {
console.log(req.body.lname);
console.log(req.body);
};
Blockquote
UPDATE but still doesn't work
exports.helloWorld = (req, res) => {
var express = require('express')
var bodyParser = require('body-parser');
var app = express();
app.use(bodyParser.urlencoded({ extended: true }))
console.log(req.body.fname);
console.log(req.headers['content-type']);
res.send(req.headers);
};