Help with Twitter API


#1

Hi Everyone, I’m just starting out in Ember, and I’m trying to get a Twitter API working

I’ve used browserify to get the twitter-node-client into the node modules, and have placed the example code from the twitter-node-client inside a .js file I run it and keep getting this error: ember.debug.js:28601 Error while processing route: firsttest _npmTwitterNodeClient.default is not a constructor TypeError: _npmTwitterNodeClient.default is not a constructor at model (htt p://localhost:4200/assets/twitter-test.js:238:27) at _emberRuntimeSystemObject.default.extend.deserialize (htt p://localhost:4200/assets/vendor.js:37097:19) at Object.applyHook (htt p://localhost:4200/assets/vendor.js:63541:30) at Object.HandlerInfo.runSharedModelHook (htt p://localhost:4200/assets/vendor.js:61749:33) at Object._routerUtils.subclass.getModel (htt p://localhost:4200/assets/vendor.js:61665:19) at htt p://localhost:4200/assets/vendor.js:63409:17 at tryCatch (htt p://localhost:4200/assets/vendor.js:63756:14) at invokeCallback (htt p://localhost:4200/assets/vendor.js:63771:15) at publish (htt p://localhost:4200/assets/vendor.js:63739:9) at htt p://localhost:4200/assets/vendor.js:42189:7

This is the code I have in the .js file

import Ember from ‘ember’; import Twitter from ‘npm:twitter-node-client’

export default Ember.Route.extend({ model() {

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

//Get this data from your twitter apps dashboard
var config = {
    "consumerKey": "MY APP KEY",
    "consumerSecret": "MY CONSUMER SECRET",
    "accessToken": "MY ACCESS TOKEN",
    "accessTokenSecret": "MY ACCESS TOKEN SECRET",
    "callBackUrl": ""
};

var twitter = new Twitter(config);

//Example calls


var woo = twitter.getUserTimeline({ screen_name: 'BoyCook', count: '10'}, error, success);
console.log(woo);

	return(woo);
}

});

Any help would be greatly appreciated.