Created
February 9, 2019 06:21
-
-
Save hyukkwonepic/16e6a755264a88772c9a9c5ecce8747a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 프로젝트의 API 키와 시크릿으로 새로운 클라이언트 객체를 생성합니다. | |
const client = stream.connect('API_KEY', 'API_SECRET', 'APP_ID'); | |
// user 피드 그룹에 대해서 1번 유저의 피드 객체를 생성합니다. | |
const userOneFeed = client.feed('user', '1'); | |
// 여러분의 DB에 새로운 트윗을 추가합니다. | |
const newTweet = await db.tweets.insert({ user: '1', tweet: '카페에 왔는데 옆자리 사람은 리눅스로 삽질을 하네. 이곳은 삽질 천국.' }); | |
// 새로 생성된 트윗 항목을 토대로 새로운 액티비티를 생성하고 userOneFeed에 추가합니다. | |
userOneFeed.addActivity({ | |
actor: 'user:1', | |
verb: 'tweet', | |
object: `tweet:{newTweet.id}` | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment