post request:
request.post('/api/pet')
.end(function(resp,err){
If (resp.body.status===200) {
alert('yay got ' JSON.stringify(res.body));
} else {
return next(resp.body);
}
});
get request:
request.get('/api/pet')
...
});
delete request:
request.del('/api/pet')
...
});
put request:
request.put('/api/pet')
...
});
The above is the entire content of this article. I hope it will be helpful to everyone learning node.js.