IronFunctions無(wú)服務(wù)器的微服務(wù)平臺(tái)
IronFunctions
IronFunctions是無(wú)服務(wù)器的微服務(wù)平臺(tái)。
一次寫(xiě)入
公有,私有和混合云
直接從 Lambda 導(dǎo)入函數(shù),并而在任何地方運(yùn)行
用 Go 開(kāi)發(fā)
示例:
下面是一個(gè)Go函數(shù),只返回“Hello $ {NAME}!”:
package main
import (
"encoding/json"
"fmt"
"os"
)
type Person struct {
Name string
}
func main() {
p := &Person{Name: "World"}
json.NewDecoder(os.Stdin).Decode(p)
fmt.Printf("Hello %v!", p.Name)
}
將上面的代碼復(fù)制并粘貼到名為func.go的文件中,然后運(yùn)行以下命令來(lái)構(gòu)建您的函數(shù)并進(jìn)行部署。
# create func.yaml file, replace $USERNAME with your Docker Hub username. fnctl init $USERNAME/hello # build the function fnctl build # test it fnctl run # push it to Docker Hub fnctl push # create an app fnctl apps create myapp # create a route that maps /hello to your new function fnctl routes create myapp /hello
現(xiàn)在可以調(diào)用你的函數(shù):
curl http://localhost:8080/r/myapp/hello
評(píng)論
圖片
表情
