Skip to content

Instantly share code, notes, and snippets.

@plutov
Created August 9, 2019 08:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save plutov/6da1f4fcccf97c0c4282d81f20ba7391 to your computer and use it in GitHub Desktop.
Save plutov/6da1f4fcccf97c0c4282d81f20ba7391 to your computer and use it in GitHub Desktop.
main.go
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