Last active
November 6, 2019 19:04
-
-
Save grant/040cc14adc7ef95837417798f46f9a61 to your computer and use it in GitHub Desktop.
Go Functions Framework – main
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "log" | |
| "os" | |
| "example.com/hello" | |
| "github.com/GoogleCloudPlatform/functions-framework-go/framework" | |
| ) | |
| func main() { | |
| framework.RegisterHTTPFunction("/", hello.HelloWorld) | |
| // Use PORT environment variable, or default to 8080. | |
| port := "8080" | |
| if envPort := os.Getenv("PORT"); envPort != "" { | |
| port = envPort | |
| } | |
| if err := framework.Start(port); err != nil { | |
| log.Fatalf("framework.Start: %v\n", err) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment