egg-alicloud-open-api
AliCloud OpenAPI plugin for egg framework
Install
$ npm i egg-alicloud-open-api --save
Usage
Enable the plugin
Change ${app_root}/config/plugin.js
to enable AliCloud plugin:
exportsaliCloud = enable: true package: 'egg-alicloud-open-api';
Configuration
Configure information in ${app_root}/config/config.{env}.js:
// ${app_root}/config/config.${env}.jsconfigaliCloud = client: clientType: 'RPC' // RPC or ROA, default RPC accessKeyId: '<accessKeyId>' accessKeySecret: '<accessKeySecret>' endpoint: '<endpoint>' apiVersion: '<apiVersion>' ;
- The
clientType
option is for creatingRPC
style client orROA
style client, defaultROA
style client. - More options
Call api
'use strict'; const Controller = Controller; async { const ctx = this; // call SendSms api const res = await ctxaliCloud; ctxbody = res; } moduleexports = HomeController;