How can I call the URL?
node-controller.js
const SerpApi = require('google-search-results-nodejs');
const search = new SerpApi.GoogleSearch("serpApi-key");
const params = {
api_key: "secret_api_key",
q: "Coffee",
location: "Austin, Texas, United States",
hl: "en",
gl: "us",
google_domain: "google.com"
};
const callback = function(data) {
console.log(data);
};
router.post('/seekSearchApi/serpapi.com/search.json', seekSearchApi);
module.exports = router;
function seekSearchApi(req, res) {
search.json(params, callback);
}
server.js
var express = require ('express');
var app = express();
app.use('/seekSearchApi/serpapi.com/search.json', require('./server/nodejs-serverapi'));
I tried to call the API using various URLs like -
http://localhost:3003/serpapi.com/search.json/?q= "Coffee",&location= "Austin, Texas, United States",&hl= "en",&gl= "us",&google_domain= "google.com"
But it did not work. What can I try next?