0.0.1 • Published 7 years ago
shuwen-news-nodejs-sdk v0.0.1
shuwen-news-nodejs-sdk
News SDK for Node.js
安装
$ npm install shuwen-news-nodejs-sdk --save
环境
Node.js >= 6.11.3
使用
初始化参数说明
- accessKey:应用 accessKey;
- secretKey:应用 secretKey;
- endpoint:接口地址,默认为
http://api.xinwen.cn
;
调用示例
const Client = require('shuwen-news-nodejs-sdk');
const client = new Client({
accessKey: '<accessKey>',
secretKey: '<secretKey>',
endpoint: '<endpoint>',
});
// => returns Promise
// client.getCategory(query, options);
client.getCategory();
// co/yield, async/await
接口文档
- 参数说明:
query
- 请求参数,对象形式options
- urllib 请求选项,详情参考:https://www.npmjs.com/package/urllib
getCategory
获得新闻的分类
getAll
获得所有新闻
getImportant
获得重大新闻
getHot
获得热门新闻
search
搜索新闻
0.0.1
7 years ago