How to send data from a form with fetch help to nodejs server using express

0
const formSignin = document.querySelector('#formSignin');

formSignin.addEventListener("submit", event =>  {
event.preventDefault();
const formDataSignin = new FormData(formSignin);

fetch('/signin', {method: 'post',    body: formDataSignin})
      .then(res => res.json())
      .then(data =>{  //Alguna respuesta  });

});

But once it arrives at the nodejs server. He says the data is undefined

console.log(req.body.user);

In contrast to the Postman tool. I can send them without problem. and they get well.

Someone could have a solution

    
asked by Nagato 23.01.2018 в 20:13
source

0 answers