Skip to content

Instantly share code, notes, and snippets.

@khannedy
Created November 6, 2022 17:10
Show Gist options
  • Save khannedy/b20b0ef60d2febafe2acda690fff4a57 to your computer and use it in GitHub Desktop.
Save khannedy/b20b0ef60d2febafe2acda690fff4a57 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"net/http"
"os"
)
func main() {
port := os.Getenv("APP_PORT")
fmt.Println("Run app in port : " + port)
http.HandleFunc("/", HelloServer)
http.ListenAndServe(":"+port, nil)
}
func HelloServer(w http.ResponseWriter, r *http.Request) {
mode := os.Getenv("MODE")
response := "Hello " + mode
fmt.Fprintf(w, response)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment