with my client js i have perform a fetch and send along some data. And i've attempted to do a res.send or res.json to send a result back.
Do I need to create a new json and send it?
This is the data being sent
let fetchData = {
method: "post",
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
username: this.state.user,
password: this.state.password,
message: null
})
}
Express server side will try to send a message to the client. but when I do this i did a console.log(res) it shows that the body is { null, null, null}
if(pw == result.password){
console.log("User and Password Correct!");
res.json({ message: 'correct' });
}
via user3307553
No comments:
Post a Comment