Open rsonghuster opened 1 year ago
web 框架还需要增加 golang 的示例
- gin
- beego
和之前的 fun 对齐, 有国际站的用户找过来,还是 funcraft 的示例
请问在这些框架类如何实现生命周期回调函数?文档只看到用fc这个的 // 注册Initializer回调方法 fc.RegisterInitializerFunction(initialize) // 注册PreStop回调方法 fc.RegisterPreStopFunction(preStop) // 注册PreFreeze回调方法 fc.RegisterPreFreezeFunction(preFreeze)
还是说必须用控制台设置(实现几个api,比如/initialize)
hi, @rsonghuster 这两个部分有什么关系吗?他们分别的作用是什么,按照你的示例去修改已有项目出现以下错误
{
"ErrorCode": "InvalidArgument",
"ErrorMessage": "Failed to start function, Code: 1, msg: function not ready:timed out after 30000 millis.:[GIN-debug] [WARNING] Creating an Engine instance with the Logger and Recovery middleware already attached.\n\n[GIN-debug] [WARNING] Running in \"debug\" mode. Switch to \"release\" mode in production.\n - using env:\texport GIN_MODE=release\n - using code:\tgin.SetMode(gin.ReleaseMode)\n\n[GIN-debug] GET /ping --> main.main.func1 (3 handlers)\n[GIN-debug] GET / --> main.main.func2 (3 handlers)\n[GIN-debug] [WARNING] You trusted all proxies, this is NOT safe. We recommend you to set a value.\nPlease check https://pkg.go.dev/github.com/gin-gonic/gin#readme-don-t-trust-all-proxies for details.\n[GIN-debug] Environment variable PORT is undefined. Using port :8080 by default\n[GIN-debug] Listening and serving HTTP on :8080\n\n"
}
and this
{
"ErrorCode": "CAFileNotFound",
"ErrorMessage": "The function cannot be started. Failed to start function instance. Error: the file /code/cmd/app/app is not exist"
}
web 框架还需要增加 golang 的示例
gin
beego
和之前的 fun 对齐, 有国际站的用户找过来,还是 funcraft 的示例