Skip to content

Instantly share code, notes, and snippets.

@mstrYoda
Created September 11, 2022 15:28
Show Gist options
  • Save mstrYoda/8531ae7caf77bda5413bbef4bcdf462f to your computer and use it in GitHub Desktop.
Save mstrYoda/8531ae7caf77bda5413bbef4bcdf462f to your computer and use it in GitHub Desktop.
func NewServer() {
srv := http.Server{
Addr: ":8080",
}
mux := http.NewServeMux()
mux.HandleFunc("/test", func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("OK"))
})
srv.Handler = mux
go srv.ListenAndServe()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment