I have a message method in which triggers when i click submit button on my form. but i am unable to access the url in my node rest api, i am trying to access the url by "req.body.url" which returns an undefined, when i see what is in req.body nothing is present. I have done this using axios it works fine help me in using fetch
message(event){
event.preventDefault();
const uri = this.state.short.url;
fetch("http://localhost:3000/messages", {
method: "post",
body: {url: uri}
})
.then(function(data) {
console.log("Request succeeded with response", data);
})
.catch(function(error) {
console.log("Request failed", error);
});
}
body: json.stringify({url})