Last active
September 18, 2021 05:57
-
-
Save percybolmer/982082277f0ee36b93f909a1370eafc8 to your computer and use it in GitHub Desktop.
An example hello world API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"net/http" | |
"os" | |
"log" | |
) | |
func main() { | |
port := fmt.Sprintf(":%s", os.Getenv("PORT")) | |
http.HandleFunc("/", HelloWorld) | |
log.Fatal(http.ListenAndServe(port, nil)) | |
} | |
func HelloWorld(w http.ResponseWriter, r *http.Request) { | |
fmt.Fprintln(w, "Hello from Docker") | |
} |
Your right, my bad... It's now fixed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Missing import "log" ?