This repository has been archived on 2022-11-30. You can view files and clone it, but cannot push or open issues or pull requests.
tacitus/http/mux.go

30 lines
408 B
Go
Raw Normal View History

2017-09-09 10:14:50 -07:00
package http
import (
2017-09-25 16:47:09 -07:00
"github.com/kcotugno/tacitus"
2017-09-09 10:14:50 -07:00
"net/http"
)
type Mux struct {
*http.ServeMux
TradeHandler TradeHandler
}
type errorResponse struct {
Error string `json:"error,omitempty"`
}
func NewMux() *Mux {
m := Mux{ServeMux: http.NewServeMux()}
m.Handle("/api/trades/", &m.TradeHandler)
return &m
}
2017-09-17 18:50:57 -07:00
func (m *Mux) SetLogger(logger tacitus.Logger) {
2017-09-25 16:47:09 -07:00
m.TradeHandler.logger = logger
2017-09-17 18:50:57 -07:00
}