eggjs plugin for invoke aliyun openapi, wrapper of OpenAPI POP core SDK for Node.js
- vod
$ npm i egg-aliyun-openapi --save
- Enable it on plugin configuration:
// {app_root}/config/plugin.[t|j]s
exports.aliyunOpenApi = {
enable: true,
package: "egg-aliyun-openapi"
};
- Configure the
access key
,access secret
, and themount paths
:
// {app_root}/config/config.default.[t|j]s
exports.aliyunOpenApi = {
key: "your access key id",
secret: "your secret access key",
regionId: 'cn-shanghai',
apiVersion: '2017-03-21',
mount: {
vod: '/aliyun-openapi/vod'
}
};
see config/config.default.ts for more detail.
- You can call it from client side now:
const res = await app
.httpRequest()
.get('/aliyun-openapi/vod?action=GetVideoPlayAuth&videoId=1234')
.expect(200)
assert.deepStrictEqual(res.body.PlayAuth, 'sstyYuew678999ew90000000xtt7TYUh')
Please open an issue here.
npm run test-local
- 1.0.0: proxy aliyun vod product
- 1.1.0: proxy ali green
- 1.2.0: Allow pass PlayConfig to vod