Answer the question
In order to leave comments, you need to log in
How to get data from Express.js post request?
Good afternoon, I am making a request from the front
const url = 'http://127.0.0.1:8080';
let val = e.target.querySelector('input').value.trim() // Тут данные есть проверял через консоль
let data = new FormData()
data.append('tel', val)
fetch(url, {
method: 'POST',
body: data
}).then(response => {
console.log(response)
}).catch(error => {
throw new Error(error)
})
app.post('/', (req, res) => {
console.log(req.params);
res.sendStatus(200);
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question