Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save tedmax100/54e8b5a418411aad663db335ec033cd2 to your computer and use it in GitHub Desktop.

Select an option

Save tedmax100/54e8b5a418411aad663db335ec033cd2 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"io"
"log"
"net/http"
)
// Greet sends a personalised greeting to writer.
func Greet(writer io.Writer, name string) {
fmt.Fprintf(writer, "Hello, %s", name)
}
// MyGreeterHandler says Hello, world over HTTP.
func MyGreeterHandler(w http.ResponseWriter, r *http.Request) {
Greet(w, "world")
}
func main() {
log.Fatal(http.ListenAndServe(":5000", http.HandlerFunc(MyGreeterHandler)))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment