@ant-basement/function-sdk
v3.0.0
Published
Ant Basement JavaScript SDK for FaaS Egg Framework
Downloads
88
Readme
function-js-sdk
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();
};