mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
refactor
This commit is contained in:
24
api/server/apps_list.go
Normal file
24
api/server/apps_list.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/iron-io/functions/api/models"
|
||||
)
|
||||
|
||||
func handleAppList(c *gin.Context) {
|
||||
log := c.MustGet("log").(logrus.FieldLogger)
|
||||
|
||||
filter := &models.AppFilter{}
|
||||
|
||||
apps, err := Api.Datastore.GetApps(filter)
|
||||
if err != nil {
|
||||
log.WithError(err).Debug(models.ErrAppsList)
|
||||
c.JSON(http.StatusInternalServerError, simpleError(models.ErrAppsList))
|
||||
return
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, &models.AppsWrapper{apps})
|
||||
}
|
||||
Reference in New Issue
Block a user