diff --git a/README.md b/README.md index a26729d..4308772 100644 --- a/README.md +++ b/README.md @@ -1,2 +1 @@ -# samples - +# go hello-world diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..9fe83cc --- /dev/null +++ b/go.mod @@ -0,0 +1,5 @@ +module example.com/hello + +go 1.17 + +require github.com/OpenFunction/functions-framework-go v0.5.0 \ No newline at end of file diff --git a/hello.go b/hello.go new file mode 100644 index 0000000..1954c23 --- /dev/null +++ b/hello.go @@ -0,0 +1,17 @@ +package hello + +import ( + "fmt" + "net/http" + + "github.com/OpenFunction/functions-framework-go/functions" +) + +func init() { + functions.HTTP("Main", Main, + functions.WithFunctionPath("/")) +} + +func Main(w http.ResponseWriter, r *http.Request) { + fmt.Fprintf(w, "Hello, world!\n") +}