Skip to content

Commit b5bcb1c

Browse files
committed
0.3.0: update example
1 parent 0f41838 commit b5bcb1c

2 files changed

Lines changed: 25 additions & 12 deletions

File tree

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,40 +15,40 @@ $ npm install duoshuo
1515
var Duoshuo = require('duoshuo');
1616

1717
var duoshuo = new Duoshuo({
18-
short_name: 'abc', // 站点申请的多说二级域名。
19-
secret: 'xxx' // 站点密钥
18+
short_name: 'abc', // 站点申请的多说二级域名。
19+
secret: 'xxx' // 站点密钥
2020
});
2121

2222
// fetch token
2323
duoshuo.auth(code, function(err,token){
24-
console.log(token)
25-
// to sth with token
24+
console.log(token)
25+
// to sth with token
2626
});
2727

2828
var access_token = 'xxxxxxxxxxxxxxxxxx'; // 通过duoshuo.auth获得的access_token
2929
var duoshuoClient = duoshuo.getClient(access_token);
3030

3131
// join local user to duoshuo.com
3232
duoshuoClient.join({
33-
user: {},
33+
user: {},
3434
}, function(err,user){
35-
console.log(err,user)
35+
console.log(err,user)
3636
});
3737

3838
// fetch top articles
3939
duoshuoClient.tops({
40-
range: 'daily' // 获取本日,详见:http://dev.duoshuo.com/docs/50398b4b8551ece011000023
41-
num_items: 10 // 获取10篇
40+
range: 'daily' // 获取本日,详见:http://dev.duoshuo.com/docs/50398b4b8551ece011000023
41+
num_items: 10 // 获取10篇
4242
}, function(err, threads){
43-
console.log(threads)
43+
console.log(threads)
4444
});
4545

4646
// push comments to duoshuo.com
4747
duoshuoClient.comment({
48-
message: '我的一条新匿名评论'
48+
message: '我的一条新匿名评论'
4949
}, function(err,comment){
50-
console.log(comment)
51-
})
50+
console.log(comment)
51+
});
5252

5353
````
5454

examples/index.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
var duoshuo = require('../index');
2+
3+
var duoshuo = new Duoshuo({
4+
short_name: 'abc', // 站点申请的多说二级域名。
5+
secret: 'xxx' // 站点密钥
6+
});
7+
8+
var access_token = 'xxxxxxxxxxxxxxxxxx'; // 通过duoshuo.auth获得的access_token
9+
var duoshuoClient = duoshuo.getClient(access_token);
10+
11+
duoshuoClient.get('abc/def.json', {}, function(err, res, body){
12+
13+
});

0 commit comments

Comments
 (0)