init
This commit is contained in:
parent
bf224ae77a
commit
4b31084ec7
|
|
@ -0,0 +1,17 @@
|
||||||
|
app = "golang-dockerfile-func-sample"
|
||||||
|
region = "asia-south1"
|
||||||
|
handler = "handler.handler"
|
||||||
|
|
||||||
|
[build]
|
||||||
|
builtin = "dockerfile"
|
||||||
|
ignorefile = ".gitignore"
|
||||||
|
|
||||||
|
[build.args]
|
||||||
|
param1 = "value1"
|
||||||
|
param2 = "value2"
|
||||||
|
|
||||||
|
[env]
|
||||||
|
FOO = "BAR"
|
||||||
|
|
||||||
|
[http_service]
|
||||||
|
internal_port = 3000
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
// Import necessary packages
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"net/http"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Define the handler function
|
||||||
|
func handler(context http.ResponseWriter, event *http.Request) {
|
||||||
|
// Initialize a map to hold the response body
|
||||||
|
response := map[string]string{
|
||||||
|
"message": "Hello, World!", // Set the message to "Hello, World!"
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the Content-Type header to application/json
|
||||||
|
context.Header().Set("Content-Type", "application/json")
|
||||||
|
|
||||||
|
// Encode the response map into JSON and write it to the response
|
||||||
|
json.NewEncoder(context).Encode(response)
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user