mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
fn: improve UX (#325)
* fn: make UX more consistent with regards to app name position * fn: improve detection of missing routes * fn: fix update operations - No longer delete-than-add for configuration updates - Path cleaning before most of routes operations
This commit is contained in:
committed by
Seif Lotfy سيف لطفي
parent
e2e82086c5
commit
fe845e1886
@@ -3,6 +3,7 @@ package server
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"path"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/iron-io/functions/api/models"
|
||||
@@ -14,10 +15,16 @@ func (s *Server) handleRouteDelete(c *gin.Context) {
|
||||
log := common.Logger(ctx)
|
||||
|
||||
appName := c.Param("app")
|
||||
routePath := c.Param("route")
|
||||
err := Api.Datastore.RemoveRoute(appName, routePath)
|
||||
routePath := path.Clean(c.Param("route"))
|
||||
|
||||
if err != nil {
|
||||
route, err := Api.Datastore.GetRoute(appName, routePath)
|
||||
if err != nil || route == nil {
|
||||
log.Error(models.ErrRoutesNotFound)
|
||||
c.JSON(http.StatusNotFound, simpleError(models.ErrRoutesNotFound))
|
||||
return
|
||||
}
|
||||
|
||||
if err := Api.Datastore.RemoveRoute(appName, routePath); err != nil {
|
||||
log.WithError(err).Debug(models.ErrRoutesRemoving)
|
||||
c.JSON(http.StatusInternalServerError, simpleError(models.ErrRoutesRemoving))
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user