Files
fn-serverless/api/server/apps_list.go
2017-05-15 11:00:15 -07:00

24 lines
436 B
Go

package server
import (
"context"
"net/http"
"github.com/gin-gonic/gin"
"github.com/treeder/functions/api/models"
)
func (s *Server) handleAppList(c *gin.Context) {
ctx := c.MustGet("ctx").(context.Context)
filter := &models.AppFilter{}
apps, err := s.Datastore.GetApps(ctx, filter)
if err != nil {
handleErrorResponse(c, err)
return
}
c.JSON(http.StatusOK, appsResponse{"Successfully listed applications", apps})
}