this is pug form which is sending data to the requested url
`form.form.form-user-data(action='/submit-user-data' method='POST')
.form__group
label.form__label(for='name') Name
input#name.form__input(type='text', value=`${user.name}`, required)
.form__group.ma-bt-md
label.form__label(for='email') Email
input#email.form__input(type='email', value=`${user.email}`, required)
.form__group.form__photo-upload
img.form__user-photo(src=`img/${user.photo}`, alt='User photo')
a.btn-text(href='') Choose new photo
.form__group.right
button.btn.btn--small.btn--green(type="submit") Save settings`
and this is is route i have created for getting data from the body
`router.post('/submit-user-data', (req, res) => {
console.log(req.body);
res.status(200).send();
});
when clicking submit i am not recieving body only {} i am receving
New contributor
harshit is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.