Created
May 30, 2016 21:53
-
-
Save m4munib/6abf1863407c8b2907af1bfe1d0777e9 to your computer and use it in GitHub Desktop.
GET/POST HTTP request Node.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*GET Request*/ | |
var httpHelper = require('./helper/http'); | |
var options = { | |
host: 'www.domain.com', | |
path: '/example-page', | |
method: 'GET' | |
}; | |
httpHelper.request(options, function (body) { | |
console.log(body); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*Post Request*/ | |
var httpHelper = require('./helper/http'); | |
var options = { | |
host: 'www.domain.com', | |
path: '/example-page', | |
method: 'POST' | |
}; | |
httpHelper.request(options, function (body) { | |
console.log(body); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment