1.0.3 • Published 3 years ago

egg-aliyun-fc v1.0.3

Weekly downloads
54
License
MIT
Repository
github
Last release
3 years ago

egg-aliyun-fc

NPM version build status Test coverage David deps Known Vulnerabilities npm download

Install

$ npm i egg-aliyun-fc --save

Usage

// {app_root}/config/plugin.js
exports.aliyunFc = {
  enable: true,
  package: 'egg-aliyun-fc',
};

Configuration

// {app_root}/config/config.default.js
exports.aliyunFc = {
  client: {
    accountId: '<>',
    accessKeyID: '<>',
    accessKeySecret: '<>',
    region: '<>'
  }
};

see config/config.default.js for more detail.

Example

export default class  queryService extends Service {
  async test() {
   const fc = this.ctx.fc;
   const functioncode = await fc.getFunctionCode('anymock', 'handler')// 这里的详细api请参见 http://doxmate.cool/aliyun/fc-nodejs-sdk/api.html#client__createFunction
   const functioncode1 = await fc.createFunction('iat_anymock', {
        functionName: 'xxx',
        handler: 'main.handler',
        runtime: 'nodejs8',
        memorySize: 100,
        timeout: 5,
        code: `
          function(event, context, callback) { 
            console.log('hello world');
            callback(null, 'hello world'); 
          }
        `
      }); // 增加了string形式的create 和update
  }
}

Questions & Suggestions

Please open an issue here.

License

MIT

1.0.3

3 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago