Please tell how to use npm googleplaces in fusetools. The Code is throwing error in
TextSearch.js (function () { “use strict”;
var querystring = require("querystring");
var https = require("https");
var HttpResponseProcessor = require("./HttpResponseProcessor.js");
var validate = require("./validate.js");
module.exports = function (apiKey, outputFormat) {
return function (parameters, callback) {
validate.apiKey(apiKey);
validate.outputFormat(outputFormat);
parameters.key = apiKey;
parameters.query = parameters.query || "restaurant";
parameters.sensor = parameters.sensor || false;
if (typeof parameters.location === "object") parameters.location = parameters.location.toString();
var options = {
hostname: "maps.googleapis.com",
path: "/maps/api/place/textsearch/" + outputFormat + "?" + querystring.stringify(parameters)
};
var request = https.request(options, new HttpResponseProcessor(outputFormat === "json", callback));
request.on("error", function (error) {
callback(new Error(error));
});
request.end();
};
};
})();
I am trying to run the following code: TextSearchTest.js
(function () { “use strict”;
// var assert = require("assert");
var TextSearch = require("TextSearch");
// var TextSearch=require("node_modules/googleplaces/lib/TextSearch.js");
var config = require("./config.js");
var textSearch = new TextSearch(config.apiKey, config.outputFormat);
var parameters = {
query: "restaurants in dublin"
};
textSearch(parameters, function (error, response) {
if (error) throw error;
// assert.notEqual(response.results.length, 0, "Text search must not return 0 results");
});
})();