Skip to content

Instantly share code, notes, and snippets.

@grant grant/main.go
Last active Nov 6, 2019

Embed
What would you like to do?
Go Functions Framework – main
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
You can’t perform that action at this time.