Open muf opened 6 years ago
router.post('/createServiceApplication',cors(), function(req, res) {
https://proinlab.com/archives/1811
function (callback) {
setTimeout(function () {
dao.getDrones(req, res, function(err, res, drones){
if (err) callback(err, drones)
else{
callback(null, drones)
}
})
}, 10000);
},
function (callback) {
dao.getServiceById(req, res, function(err, res, service){
if (err) callback(err, service)
else{
callback(null, service)
}
})
}
request.post( 'http://www.yoursite.com/formpage', { json: { key: 'value' } }, function (error, response, body) { if (!error && response.statusCode == 200) { console.log(body) } } );
var http = require('http');
var options = { host: 'www.host.com', path: '/', port: '80', method: 'POST' };
callback = function(response) { var str = '' response.on('data', function (chunk) { str += chunk; });
response.on('end', function () { console.log(str); }); }
var req = http.request(options, callback); //This is the data we are posting, it needs to be a string or a buffer req.write("data"); req.end();
var myJSONObject = { ... }; request({ url: "http://josiahchoi.com/myjson", method: "POST", json: true, // <--Very important!!! body: myJSONObject }, function (error, response, body){ console.log(response); });