var unirest = require('unirest'); exports.view = function(req, res){ // unirest.get("https://yourmapper2.p.mashape.com/datasetlist?format=json&maxlat=40&maxlon=-70&minlat=30&minlon=-90&num=5&sort=location") // .header("X-Mashape-Key", "gj4g6D3zxKmshys7yyf9KNbuywOxp1ueazFjsn6n2fK4sccIGA") // .header("Accept", "application/json") // .end(function (result) { // // console.log(result.status, result.headers, result.body); // }); //37.782551, -122.445368 // These code snippets use an open-source library. http://unirest.io/nodejs //generate the json file here, for now just one call to demonstrate it works unirest.get("https://crimescore.p.mashape.com/crimescore?f=json&id=174&lat=37.782551&lon=-122.445368") .header("X-Mashape-Key", "gj4g6D3zxKmshys7yyf9KNbuywOxp1ueazFjsn6n2fK4sccIGA") .header("Accept", "application/json") .end(function (result) { res.render('pages/tempcrime', result); console.log(result.status, result.headers, result.body); }); };