Skip to content

eggjs plugin for invoke aliyun openapi, wrapper of OpenAPI POP core SDK for Node.js

License

Notifications You must be signed in to change notification settings

Jeff-Tian/egg-aliyun-openapi

Repository files navigation

egg-aliyun-openai

eggjs plugin for invoke aliyun openapi, wrapper of OpenAPI POP core SDK for Node.js

NPM version Build Status codecov David deps Known Vulnerabilities npm download

Quality gate

Functionality

  • vod

Install

$ npm i egg-aliyun-openapi --save

Usage

  1. Enable it on plugin configuration:
// {app_root}/config/plugin.[t|j]s
exports.aliyunOpenApi = {
  enable: true,
  package: "egg-aliyun-openapi"
};
  1. Configure the access key, access secret, and the mount 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.

  1. 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')

Questions & Suggestions

Please open an issue here.

License

MIT

Test

npm run test-local

Release Notes:

  • 1.0.0: proxy aliyun vod product
  • 1.1.0: proxy ali green
  • 1.2.0: Allow pass PlayConfig to vod

About

eggjs plugin for invoke aliyun openapi, wrapper of OpenAPI POP core SDK for Node.js

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published