Skip to content

Instantly share code, notes, and snippets.

@rscarrera27
Created February 9, 2020 10:15
Show Gist options
  • Save rscarrera27/e180db8ed57feb72d8842fe2c1c11905 to your computer and use it in GitHub Desktop.
Save rscarrera27/e180db8ed57feb72d8842fe2c1c11905 to your computer and use it in GitHub Desktop.
Golang HTTP handling example
package main
import (
"fmt"
"net/http"
)
type Hello struct{}
func (h Hello) ServeHTTP(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, "Hello!")
}
func main() {
var h Hello
http.ListenAndServe("localhost:4000", h)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment