Restructured services
This commit is contained in:
@@ -12,7 +12,7 @@ type Post struct {
|
||||
}
|
||||
|
||||
type Board struct {
|
||||
service.Service
|
||||
*service.Service
|
||||
|
||||
root string
|
||||
mux *http.ServeMux
|
||||
@@ -25,15 +25,11 @@ type Board struct {
|
||||
func main () {
|
||||
board := Board { root: "/board/" }
|
||||
board.mux = http.NewServeMux()
|
||||
board.Service = service.Service {
|
||||
&service.HTTP {
|
||||
Mount: service.M (
|
||||
"Board",
|
||||
"A board where you can post things.",
|
||||
"@", board.root),
|
||||
Handler: board.mux,
|
||||
},
|
||||
}
|
||||
board.Service = service.NewService (
|
||||
"Board",
|
||||
"A board where you can post things.",
|
||||
service.NewHTTP("@", board.root, board.mux))
|
||||
|
||||
handle := func (pattern string, handler func (http.ResponseWriter, *http.Request)) {
|
||||
board.mux.HandleFunc(pattern, handler)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user