app

package
v0.0.0-...-3423bc7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 19, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleLive

func HandleLive(w http.ResponseWriter, _ *http.Request)

HandleLive - A http.HandlerFunc that handles liveness checks by immediately responding with an HTTP 200 status.

Types

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server - application representation wrapping a logger.Logger

func New

func New(l *logger.Logger,
	db *gorm.DB,
) *Server

New - Creates a new Server with supplied logger.Logger

func (*Server) HandleCreateBook

func (s *Server) HandleCreateBook(w http.ResponseWriter, r *http.Request)

HandleCreateBook - http route to create new book, with supplied model.Book json

func (*Server) HandleDeleteBook

func (s *Server) HandleDeleteBook(w http.ResponseWriter, r *http.Request)

HandleDeleteBook - http request to handle delete book request by bookId

func (*Server) HandleIndex

func (s *Server) HandleIndex(w http.ResponseWriter, _ *http.Request)

HandleIndex - HandleIndex is the router to process index request.

func (*Server) HandleListBooks

func (s *Server) HandleListBooks(w http.ResponseWriter, _ *http.Request)

HandleListBooks - http route to list all the books. Returns result in form of model.BookDtos

func (*Server) HandleReadBook

func (s *Server) HandleReadBook(w http.ResponseWriter, r *http.Request)

HandleReadBook - http route to handle book by id request. Returns result in form of model.BookDto json

func (*Server) HandleReady

func (s *Server) HandleReady(w http.ResponseWriter, _ *http.Request)

HandleReady - A http.HandlerFunc that handles readiness checks by responding with an HTTP 200 status if it is healthy, 500 otherwise.

func (*Server) HandleUpdateBook

func (s *Server) HandleUpdateBook(w http.ResponseWriter, r *http.Request)

HandleUpdateBook - http route to handle update book based on id and supplied model.Book json payload

func (*Server) Logger

func (s *Server) Logger() *logger.Logger

Logger - return logger.Logger instance associated with the Server

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL