environment-variables/handler.go

16 lines
259 B
Go

package main
import (
"net/http"
"os"
)
// Handler function to handle requests
func handler(w http.ResponseWriter, r *http.Request) {
foo := os.Getenv("FOO")
if foo == "" {
foo = "Specified environment variable is not set."
}
w.Write([]byte(foo))
}