Created
May 30, 2016 21:53
Star
You must be signed in to star a gist
GET/POST HTTP request Node.js
This file contains 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 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