Library/routes/api/v1/books_list.go

19 lines
316 B
Go
Raw Normal View History

2017-10-09 12:29:21 +00:00
package v1
import (
"github.com/labstack/echo"
"net/http"
"git.mowie.cc/konrad/Library/models"
2017-10-09 12:29:21 +00:00
)
func List(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)
2017-10-09 12:29:21 +00:00
}