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

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
}