mirror of
https://github.com/foomo/squadron.git
synced 2025-10-16 12:35:42 +00:00
22 lines
433 B
Go
22 lines
433 B
Go
package main
|
|
|
|
import (
|
|
"flag"
|
|
"log"
|
|
"net/http"
|
|
)
|
|
|
|
func main() {
|
|
flagAddress := flag.String("address", ":80", "address to listen to ")
|
|
flagGreeting := flag.String("greeting", "HELLO", "sets the greeting message")
|
|
flag.Parse()
|
|
|
|
greeting := []byte(*flagGreeting)
|
|
|
|
handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
_, _ = w.Write(greeting)
|
|
})
|
|
|
|
log.Fatal(http.ListenAndServe(*flagAddress, handler))
|
|
}
|