From 2118732d78762cdf2e9cd453866283bf110e02af Mon Sep 17 00:00:00 2001 From: Sameer Dev Date: Tue, 23 Apr 2024 15:50:38 +0530 Subject: [PATCH] init --- fc.toml | 26 ++++++++++++++++++++++++++ go.mod | 3 +++ main.go | 19 +++++++++++++++++++ 3 files changed, 48 insertions(+) create mode 100644 fc.toml create mode 100644 go.mod create mode 100644 main.go diff --git a/fc.toml b/fc.toml new file mode 100644 index 0000000..6910e18 --- /dev/null +++ b/fc.toml @@ -0,0 +1,26 @@ +app = "golang-buildpack-app-sample" +region = "asia-south1" +handler = "" + +[build] + buildpack_builder = "paketobuildpacks/builder-jammy-base" + buildpacks = ["paketo-buildpacks/go"] + ignorefile = ".gitignore" + [build.args] + foo = "bar" + +[env] + FOO = "BAR" + +[http_service] + internal_port = 3000 + + [[http_service.checks]] + interval = "1m21s" + timeout = "7s" + grace_period = "2s" + method = "GET" + path = "/" + protocol = "http" + [http_service.checks.headers] + My-Custom-Header = "whatever" diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..e04299a --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module golang-buildpack-app-sample + +go 1.21.5 diff --git a/main.go b/main.go new file mode 100644 index 0000000..cae698d --- /dev/null +++ b/main.go @@ -0,0 +1,19 @@ +package main + +import ( + "fmt" + "net/http" +) + +func handler(w http.ResponseWriter, r *http.Request) { + fmt.Fprintf(w, "Hello World!") +} + +func main() { + // Register the handler function to handle requests to "/" + http.HandleFunc("/", handler) + + // Start the HTTP server on port 3000 + fmt.Println("Example app listening on port 3000!") + http.ListenAndServe(":3000", nil) +}