Documentation ¶
Index ¶
- func ConfigureServer(handler *Handler) *mux.Router
- type Handler
- func (h *Handler) BookUpsert(w http.ResponseWriter, r *http.Request)
- func (h *Handler) Index(w http.ResponseWriter, r *http.Request)
- func (h *Handler) ListBooks(w http.ResponseWriter, r *http.Request)
- func (h *Handler) ListUserByID(w http.ResponseWriter, r *http.Request)
- func (h *Handler) SwapBook(w http.ResponseWriter, r *http.Request)
- func (h *Handler) UserUpsert(w http.ResponseWriter, r *http.Request)
- type Response
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigureServer ¶
ConfigureServer configures the routes of this server and binds handler functions to them
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler contains the handler and all its dependencies.
func NewHandler ¶
func NewHandler(bs *db.BookRepository, us *db.UserService) *Handler
NewHandler initialises a new handler, given dependencies.
func (*Handler) BookUpsert ¶
func (h *Handler) BookUpsert(w http.ResponseWriter, r *http.Request)
BookUpsert is invoked by HTTP POST /books.
func (*Handler) Index ¶
func (h *Handler) Index(w http.ResponseWriter, r *http.Request)
Index is invoked by HTTP GET /.
func (*Handler) ListBooks ¶
func (h *Handler) ListBooks(w http.ResponseWriter, r *http.Request)
ListBooks is invoked by HTTP GET /books.
func (*Handler) ListUserByID ¶
func (h *Handler) ListUserByID(w http.ResponseWriter, r *http.Request)
ListUserByID is invoked by HTTP GET /users/{id}.
func (*Handler) SwapBook ¶
func (h *Handler) SwapBook(w http.ResponseWriter, r *http.Request)
SwapBook is invoked by POST /books/{id}
func (*Handler) UserUpsert ¶
func (h *Handler) UserUpsert(w http.ResponseWriter, r *http.Request)
UserUpsert is invoked by HTTP POST /users.
Click to show internal directories.
Click to hide internal directories.