On the moment, I am at the point where the client can send requests to the server, have the server perform actions and send back a response to the client.
For exemple, when I want to change a password, I verify the old password in my database. If it matches, the password is updated and I send a 200 response like so :
sendResponse("User's Password Updated", exchange, 200, true);
which is read in chrome's network tab as : { "response" : "User's Password Updated"}
If the old password is wrong (can't verify the user's identity), it sends the following message :
sendResponse("User's password could not be verified", exchange, 200, true);
which is read in chrome's network tab as : { "response" : "User's password could not be verified"}
Now what I want to do is to perform a different action on my client for each action. For this exemple, let's log a message.
I want to have something like that (pseudocode):
if (response === "User's password could not be verified")
console.log('User's password could not be verified');
else if ( response === "User's Password Updated")
console.log('User's Password Updated');
keep in mind this is my first time using http, and I am pretty happy with myself being able to display the different responses in the network tab