Hi community,
I would like get my server methods on client, but i’ve ‘error 404’ when i try to show my screenName. My code :
`if (Meteor.isServer) {
Meteor.startup(function () {
var Twit = require('twit');
apiKeys = {
consumer_key: 'xxx', // API key
consumer_secret: 'xxx', // API secret
access_token: 'xxx',
access_token_secret: 'xxx'
}
var T = new Twit(apiKeys);
T.get('statuses/user_timeline', { screen_name: 'ILeG3nDz', count: 2 }, Meteor.bindEnvironment(function(err, data, response) {
Meteor.methods({
screenName: function() {
return data;
}
})
}));
});
}
if (Meteor.isClient) {
Meteor.call('screenName', function (error, result) {
if (error) {
console.log(error);
} else {
//console.log(result[0].text);
Session.set('test', result[0].text);
}
});
Template.latestTweet.helpers({
getTweet: function () {
return Session.get('test');
}
});
}`
I don’t know why i’ve this error. Do you have idea ?
Object { stack: "Meteor.makeErrorType/errorClass@htt…", error: 404, reason: "Method 'screenName' not found", details: undefined, message: "Method 'screenName' not found [404]", errorType: "Meteor.Error" }
Thank you !