UNPKG

shhwallet

Version:
35 lines (28 loc) 556 B
var http = require('http'); var data = JSON.stringify({ firstName: 'JoaquÌn', }); var options = { host: '127.0.0.1', port: 8333, path: '/', method: 'POST', headers: { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(data) } }; var req = http.request(options, function(res) { var result = ''; res.on('data', function(chunk) { result += chunk; }); res.on('end', function() { console.log(result); }); }); req.on('error', function(err) { console.log(err); }); req.write(data); req.end();