This commit is contained in:
Pedro Nasser
2016-08-01 19:23:31 -03:00
parent f9f1ffaac5
commit dfc4be9861
25 changed files with 137 additions and 160 deletions

30
api/server/apps_get.go Normal file
View File

@@ -0,0 +1,30 @@
package server
import (
"net/http"
"github.com/Sirupsen/logrus"
"github.com/gin-gonic/gin"
"github.com/iron-io/functions/api/models"
)
func handleAppGet(c *gin.Context) {
log := c.MustGet("log").(logrus.FieldLogger)
appName := c.Param("app")
app, err := Api.Datastore.GetApp(appName)
if err != nil {
log.WithError(err).Error(models.ErrAppsGet)
c.JSON(http.StatusInternalServerError, simpleError(models.ErrAppsGet))
return
}
if app == nil {
log.WithError(err).Error(models.ErrAppsNotFound)
c.JSON(http.StatusNotFound, simpleError(models.ErrAppsNotFound))
return
}
c.JSON(http.StatusOK, &models.AppWrapper{app})
}