Reputation: 13923
I got a post function to add new user. I dont see any need to return anything to the client. Will the node thread stuck until he find a respond to send back? Is this a good approach?
(I use express)
app.post('/newUser',function(req,res){
users.push(req.body.user);
});
Upvotes: 0
Views: 25
Reputation: 2476
You should always return something to the client. The client waits for a response.
In the case of adding a user, you could return the created user or, if it fails, an error message.
Upvotes: 1