Skip to content

Instantly share code, notes, and snippets.

@christianb93
Created February 8, 2020 16:52
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 christianb93/4b23d7a5aa715986eb2d20077ba00fc1 to your computer and use it in GitHub Desktop.
Save christianb93/4b23d7a5aa715986eb2d20077ba00fc1 to your computer and use it in GitHub Desktop.
package main
import (
"log"
"net/http"
"os"
)
func build_handler(msg string) func(http.ResponseWriter, *http.Request) {
return func(writer http.ResponseWriter, request *http.Request) {
writer.Write([]byte(msg + "\n"))
}
}
func main() {
msg:= os.Args[1]
http.HandleFunc("/", build_handler(msg))
log.Fatal(http.ListenAndServe(":8888", nil))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment