After a successful creation of new item in my database I send:
res.status(201).json({message:"Successfully Registered"});
On my angular front end I am able to console.log(res)
and receive:
{message: "Successfully Registered"}
1) How do I get the status code on the front end? res.status
returns undefined. The only response I'm getting is the JSON.
2) What would be the best way to confirm successful desired api calls? For example, when I log in and credentials are correct, should I check for a 200
and then proceed? Or send a custom JSON message and check if the message for example says "Successful login" then proceed?