Skip to content

Commit

Permalink
Add listing 7.15
Browse files Browse the repository at this point in the history
  • Loading branch information
inancgumus committed May 8, 2023
1 parent 05fed73 commit c3bd278
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ch07/cmd/shortd/shortd.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"os"
"time"

"github.com/inancgumus/effective-go/ch07/httpio"
"github.com/inancgumus/effective-go/ch07/shortener"
)

Expand All @@ -28,6 +29,9 @@ func main() {
Handler: http.TimeoutHandler(shortenerServer, *timeout, "timeout"),
ReadTimeout: *timeout,
}
if os.Getenv("BITE_DEBUG") == "1" {
server.Handler = httpio.LoggingMiddleware(server.Handler)
}
err := server.ListenAndServe()
if !errors.Is(err, http.ErrServerClosed) {
fmt.Fprintln(os.Stderr, "server closed unexpectedly:", err)
Expand Down

0 comments on commit c3bd278

Please sign in to comment.