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.
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn