Files
fn-serverless/api/server/router/routes_destroy.go
2016-07-21 16:09:21 -03:00

27 lines
577 B
Go

package router
import (
"net/http"
"github.com/Sirupsen/logrus"
"github.com/gin-gonic/gin"
"github.com/iron-io/functions/api/models"
)
func handleRouteDestroy(c *gin.Context) {
store := c.MustGet("store").(models.Datastore)
log := c.MustGet("log").(logrus.FieldLogger)
appName := c.Param("app")
routeName := c.Param("route")
err := store.RemoveRoute(appName, routeName)
if err != nil {
log.WithError(err).Debug(models.ErrRoutesRemoving)
c.JSON(http.StatusInternalServerError, simpleError(models.ErrRoutesRemoving))
return
}
c.JSON(http.StatusOK, nil)
}