Created
August 9, 2019 08:56
-
-
Save plutov/6da1f4fcccf97c0c4282d81f20ba7391 to your computer and use it in GitHub Desktop.
main.go
This file contains 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 ( | |
"log" | |
"net/http" | |
) | |
func main() { | |
mux := http.NewServeMux() | |
mux.HandleFunc("/", okHandler) | |
if err := http.ListenAndServe(":8888", mux); err != nil { | |
log.Fatalf("unable to start server: %s", err.Error()) | |
} | |
} | |
func okHandler(w http.ResponseWriter, r *http.Request) { | |
// Some very expensive database call | |
w.Write([]byte("alles gut")) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment