I was trying to make a post request from my server to a rest API which records data for auditing,
I found requestify as very clean package for node.js
Get Implementation below:
POST Implementation
I found requestify as very clean package for node.js
Get Implementation below:
var requestify = require('requestify');
requestify.get('https://reqres.in/api/users?page=2')
.then(function(response) {
// Get the response body (JSON parsed - JSON response or jQuery object in case of XML response)
console.log(response.getBody());
// Get the response raw body
console.log(response.body);
});
POST Implementation
requestify.post('https://reqres.in/api/users', {
"name": "Asker",
"job": "SSE"
}).then(function(response) {
// Get the response body
console.log(response.getBody());
console.log(response.body);
});
