mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
* fix datastore error inexistent app * fix get route error handling * fix API errors handling and tests
24 lines
436 B
Go
24 lines
436 B
Go
package server
|
|
|
|
import (
|
|
"context"
|
|
"net/http"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
"github.com/iron-io/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})
|
|
}
|