Skip to content

Instantly share code, notes, and snippets.

@nstogner
Last active June 5, 2017 22:17
Show Gist options
  • Save nstogner/ada81a624428d17077a81fbf4e20a421 to your computer and use it in GitHub Desktop.
Save nstogner/ada81a624428d17077a81fbf4e20a421 to your computer and use it in GitHub Desktop.
Go: HTTP Status Logging Middleware Usage
func main() {
http.ListenAndServe(":8080",
logware(
http.HandlerFunc(handle),
),
)
}
func handle(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(201)
w.Write([]byte("Accepted"))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment