Trying to test Twitter API search query



I’m trying to test a Twitter API search query using JavaScript in AWS Cloud 9.

Here’s the query:
twitter.getSearch({‘q’:’ #voicefirst’, ‘result_type’:‘popular’}, error, success);

I have the Twitter app setup. Have the authorization codes.

I’m not clear on the function code required in the index.js and package.json files, though.

Below is the code for index.js (authorization codes removed). If anyone can give me any suggestions on how to use Cloud 9 to test this, I’d greatly appreciate it. Thx.

'use strict';

exports.handler = (event, context, callback) => {
    // TODO implement

  // Callback functions
var error = function (err, response, body) {
    	console.log('ERROR [%s]', JSON.stringify(err));
	var success = function (data) {
    	console.log('Data [%s]', data);

var Twitter = require('twitter-node-client').Twitter;

//Get this data from your twitter apps dashboard
	var config = {

    	"consumerKey": "",
    	"consumerSecret": "",
    	"accessToken": "",
    	"accessTokenSecret": "",
    	"callBackUrl": ""

       var twitter = new Twitter();

twitter.getSearch({'q':' #voicefirst', 'result_type':'popular'}, error, success);