想学习下云函数入口函数,这种多路由的方式,是什么原理?

小程序 文章 2022-02-25 11:40 335 0 全屏看文

AI助手支持GPT4.0

想学习下云函数入口函数,这种多路由的方式,是什么原理?Want to learn the entry function of the cloud function, what is the principle of this multi-routing method?

想学习下云函数入口函数,这种多路由的方式,是什么原理?

这种云函数入口函数的,这点的工作原理是什么?event里面都有什么?

关于这个知识点的文档连接在哪里呢?

What is the working principle of this cloud function entry function? What's in event? Where are the documents about this knowledge point connected?

回答:

Mr.Zhao:

路由?就是一个流程控制 if else而已。event是小程序传给云函数的参数

依然饭特稀:哦哦,好的,谢谢
崔晏哲:

自定义 type 类型,用 sitch case 判断,匹配到的就执行对应文件的代码

依然饭特稀:好的,谢谢,刚才看了下代码,原来小程序端调用云函数callfunction的时候传入有name是云函数的名字,还可以在data里面传入type参数,然后云函数端再获取参数data,在判断type,好吧,好吧...
老张:

1、属于nodejs基本语法了。最像的可以参考koa2

-EOF-

AI助手支持GPT4.0