@ant-basement/function-sdk

Ant Basement JavaScript SDK for FaaS Egg Framework

Usage no npm install needed!

<script type="module">
  import antBasementFunctionSdk from 'https://cdn.skypack.dev/@ant-basement/function-sdk';
</script>

README

function-js-sdk

Latest Stable Version License NPM Downloads

Basement SDK for Function service

Getting Started

tnpm install --save @ant-basement/function-sdk

Usage

// app.js
const urllib = require('urllib');
const Basement = require('@ant-basement/function-sdk');
app.basement = new Basement({
  spaceId: '148086d2-6881-434d-849b-e22bc687a0c2',
  endpoint: '47.100.226.126',
  serverSecret: 'KZMLzTM1q1WyOWVX+nlscgbhgL7B1RQFxrMolIY1U6Yq5rS79aNyDEnAUIhI/v8Q',
  logger: app.loggers.coreLogger.info,
  httpclient: urllib,
});

// controller/home.js
exports.index = async () => {
  const collectionNames = await app.basement.db.collections();
  const newFile = await app.basement.file.uploadFile();
  const newFileWithUser = await app.basement.setUserId('user_id1234').file.uploadFile();
};