で REST を使用して手動で行う場合を除き、少し役立つ API が必要ですMeteor.http
。隕石を入手することをお勧めします: https://github.com/oortcloud/meteorite
ノードモジュールのようにインストールされますnpm install -g meteorite
Meteorite は meteor のラッパーで、http://atmosphere.meteor.comでコミュニティ パッケージを使用できます。
使用できる twitter パッケージは、https : //github.com/Sewdn/meteor-twitter-apitwitter-api
からインストールされます。mrt add twitter-api
サーバー API を使用して追加すると、次の方法でツイートを追加できます。
サーバーJS
var twitter = new Twitter();
Meteor.methods({
postTweet: function (text) {
if(Meteor.user())
twitter.postTweet(text),
return true;
}
});
クライアント JS
//Use this in your click handler where you want to post a tweet:
Meteor.call("postTweet", "This is Twweeeeeetttt!", function(err,result) {
if(!err) {
alert("Tweet posted");
}
});
API がユーザーの oauth トークンを処理するので、あまり心配する必要はありません