Created
April 20, 2019 09:31
-
-
Save oliverpauffley/f15ce43e9e94c78582404e21c8ed0002 to your computer and use it in GitHub Desktop.
Handlers-type-embed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type PlayerServer struct { | |
store PlayerStore | |
http.Handler | |
} | |
func NewPlayerServer(store PlayerStore) *PlayerServer { | |
p := new(PlayerServer) | |
p.store = store | |
router := http.NewServeMux() | |
router.Handle("/league", http.HandlerFunc(p.leagueHandler)) | |
router.Handle("/players/", http.HandlerFunc(p.playersHandler)) | |
p.Handler = router | |
return p | |
} | |
// Now the ServeHTTP is gone altogether?! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment