initial router tests: apps

This commit is contained in:
Pedro Nasser
2016-07-29 19:35:38 -03:00
parent 0facc5dbff
commit b319fa6b31
10 changed files with 297 additions and 4 deletions

View File

@@ -0,0 +1,25 @@
package router
import (
"net/http"
"github.com/Sirupsen/logrus"
"github.com/gin-gonic/gin"
"github.com/iron-io/functions/api/models"
)
func handleAppDelete(c *gin.Context) {
store := c.MustGet("store").(models.Datastore)
log := c.MustGet("log").(logrus.FieldLogger)
appName := c.Param("app")
err := store.RemoveApp(appName)
if err != nil {
log.WithError(err).Debug(models.ErrAppsRemoving)
c.JSON(http.StatusInternalServerError, simpleError(models.ErrAppsRemoving))
return
}
c.JSON(http.StatusOK, nil)
}