Exemplo n.º 1
0
func GetAllBooksForAuthor(c echo.Context) error {
	authorID, err := strconv.Atoi(c.Param("id"))
	if err != nil {
		return c.JSON(http.StatusBadRequest, err.Error)
	}

	books := services.GetBookService().GetBooksByAuthor(authorID)

	return c.JSON(http.StatusOK, books)
}
Exemplo n.º 2
0
func GetAllBooks(c echo.Context) error {
	books := services.GetBookService().GetAllBooks()

	return c.JSON(http.StatusOK, books)
}