Skip to content

Commit

Permalink
more comprehensive code
Browse files Browse the repository at this point in the history
  • Loading branch information
cszichao committed Mar 9, 2018
1 parent c3b5c25 commit dac3ab4
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions example/httpdaemon/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ var (
)

func main() {
d := daemon.Make("-s", "httpdaemon", "simple http daemon service")
daemon.Make("-s", "httpdaemon", "simple http daemon service").Run(serve)
}

d.Run(func() {
flag.Parse()
http.HandleFunc("/hello",
func(w http.ResponseWriter, req *http.Request) {
io.WriteString(w, "hello, world!\n")
},
)
http.ListenAndServe(fmt.Sprintf(":%d", *port), nil)
})
func serve() {
flag.Parse()
http.HandleFunc("/hello",
func(w http.ResponseWriter, req *http.Request) {
io.WriteString(w, "hello, world!\n")
},
)
http.ListenAndServe(fmt.Sprintf(":%d", *port), nil)
}

0 comments on commit dac3ab4

Please sign in to comment.