Skip to content

Instantly share code, notes, and snippets.

@augustohp
Forked from jasonrhodes/xml2json.js
Last active December 25, 2015 07:49
Show Gist options
  • Save augustohp/6942270 to your computer and use it in GitHub Desktop.
Save augustohp/6942270 to your computer and use it in GitHub Desktop.
var http = require('http');
var xmld = require('xml2js');
var express = require('express');
var app = express();
// app.use(express.static(__dirname + '/public'));
app.get("/", function (req, res) {
var options = {
hostname: "search.mysite.com",
path: '/search?site=hub&client=hub_frontend&output=xml_no_dtd&q=cats'
};
var gsaReq = http.get(options, function (response) {
var completeResponse = '';
response.on('data', function (chunk) {
completeResponse += chunk;
});
response.on('end', function() {
console.log(completeResponse);
})
}).on('error', function (e) {
console.log('problem with request: ' + e.message);
});
});
app.listen(3000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment