28 lines
376 B
Go
28 lines
376 B
Go
package http
|
|
|
|
import (
|
|
"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
|
|
}
|
|
|
|
func (m *Mux) SetLogger(logger tacitus.Logger) {
|
|
m.TradeHandler.Logger = logger
|
|
}
|