Skip to content

Instantly share code, notes, and snippets.

@ernestkamara
Last active March 23, 2020 10:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ernestkamara/894831f45f5e7094d3a203f73d4f5b30 to your computer and use it in GitHub Desktop.
Save ernestkamara/894831f45f5e7094d3a203f73d4f5b30 to your computer and use it in GitHub Desktop.
Cloud Functions Demo
// Create the serpwow object, passing in our API key
const serpwow = new SerpWow(API_KEY);
// Initialize the default app
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
databaseURL: "https://APP_ID.firebaseio.com"
});
// Minimum time period(i.e. 'from') search parameter
const min_date = moment().subtract(1, 'days').format("MM/DD/YYYY");
// Maximum time period(i.e. 'to') search parameter
const max_date = moment().format("MM/DD/YYYY");
// Set up the search parameters,
const params = {
q: 'freetown',
search_type: 'news',
news_type: 'all',
num: '10',
time_period: 'custom',
sort_by: 'date',
time_period_min: min_date,
time_period_max: max_date
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment