Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@alicloud/mpserverless-sdk

Package Overview
Dependencies
Maintainers
13
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@alicloud/mpserverless-sdk

JavaScript SDK for Alicloud MPServerless

  • 2.2.4-alpha.0
  • npm
  • Socket score

Version published
Weekly downloads
68
increased by871.43%
Maintainers
13
Weekly downloads
 
Created
Source

MPServerless SDK

NPM

MPServerless SDK

Getting Started

npm install --save @alicloud/mpserverless-sdk

Usage

const MPServerless = require('@alicloud/mpserverless-sdk');
const mpServerless = new MPServerless({
  uploadFile: my.uploadFile,
  request: my.request,
  getAuthCode: my.getAuthCode,
}, {
  appId: 'xxx', // 小程序应用标识
  spaceId: 'xxx', // 服务空间标识
  clientSecret: 'xxx', // 服务空间 secret key
  endpoint: 'https://webgw.basement.nlark.com' // 服务空间地址,从小程序 serverless 控制台处获得
});

mpServerless.user.getInfo().then(res => {
  console.log('user info', res);
});
mpServerless.db.collection('task').find().then(res => {
  console.log('task list', res.result);
});
mpServerless.function.invoke('sayHello', { name: 'angela' }).then(res => {
  console.log(res.result + ' says angela');
});

my.chooseImage({
  chooseImage: 1,
  success: res => {
    const path = res.apFilePaths[0];
    const that = this;
    my.getImageInfo({
      src: path,
      success: function(res) {
        const options = {
          filePath: path,
          extension: res.type,
          headers: {
            contentDisposition: 'inline',
          },
        };
        app.mpServerless.file.uploadFile(options).then((image) => {
          that.setData({
            iconUrl: image.fileUrl,
          });
        }).catch(console.error);
      },
      fail: function(err) {
        console.log(err);
      }
    });
  },
});

FAQs

Package last updated on 06 Jan 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc