How can I make an outbound HTTP POST request, with data, in node.js?
I like the simplicity of superagent (https://github.com/visionmedia/superagent). Same API on both node and browser.
;(async function() {
var response = await superagent.post('http://127.0.0.1:8125/', {age: 2})
console.log(response)
})
There is also node-fetch (https://www.npmjs.com/package/node-fetch), which has an API that matches fetch
from the browsers - however this requires manual query string encoding, does not automatically handle content types, or so any of the other work superagent does.