21 lines
365 B
Go
21 lines
365 B
Go
package v1
|
|
|
|
import (
|
|
"github.com/labstack/echo"
|
|
"net/http"
|
|
|
|
"git.mowie.cc/konrad/Library/models"
|
|
)
|
|
|
|
// BookList is the handler to list books
|
|
func BookList(c echo.Context) error {
|
|
|
|
list, err := models.ListBooks("")
|
|
|
|
if err != nil {
|
|
return c.JSON(http.StatusInternalServerError, models.Message{"Error getting books"})
|
|
}
|
|
|
|
return c.JSON(http.StatusOK, list)
|
|
}
|