Appearance
createFaaS
▸ createFaaS(fn
, options?
): (event
: FaaSEvent
) => Promise
<any
>
构造一个云函数
参数
Name | Type |
---|---|
fn | (event : FaaSEvent ) => Promise <any > |
options? | CreateFaaSOptions |
返回值
fn
▸ (event
): Promise
<any
>
参数
Name | Type |
---|---|
event | FaaSEvent |
返回值
Promise
<any
>
示例
ts
import {createFaaS, defineProps} from '@ifanrx/faas'
import {number, string} from 'yup'
export default createFaaS(
event => {
console.log(event)
return 'hello world'
},
{
baasVersion: '3.21.0', // 指定 BaaS 版本号为 3.21.0
allowSdkInvoke: false, // 禁止通过 sdk 调用云函数,通常指不允许在小程序端调用云函数
}
)