ruk·si

🟢 Node
Request

Updated at 2013-07-04 09:05

Request is simple HTTP request client for Node.js.

var url = require('url');
var request = require('request');

options = {
  protocol: "http:",
  host: "search.twitter.com",
  pathname: '/search.json',
  query: { q: "search term"}
};
var searchUrl = url.format(options);

request(searchUrl, function(error, response, body) {
  if (!error && response.statusCode == 200) {
    console.log(body);
  }
})