Here is my html:
<form action='/new' method='POST' >
<span>pool name: </span>
<input type="text" name="name" />
<input type="hidden" name="imageSrcList" />
<button type='submit' >Create new</button>
</form>
And here is the relevant JS:
var app = express()
app.use(fileUpload());
app.set('view engine', 'ejs')
app.use(express.static(__dirname + '/views'));
app.post('/new', (req, res) => {
console.log(req.body.name);
})
The console reads out:
TypeError: Cannot read property 'name' of undefined
I have tried with console.log(req.body)
and this also is undefined.
Thanks in advance!
via Zoe Carver
No comments:
Post a Comment