Files
fn-serverless/api/server/routes_get.go
Travis Reeder fdb4188146 Adds before/after app get/list. And some bug fixes/cleanup. (#610)
* Adds before/after app get/list. And some bug fixes/cleanup.

* Fix test
2017-12-21 09:32:03 -08:00

24 lines
491 B
Go

package server
import (
"net/http"
"path"
"github.com/fnproject/fn/api"
"github.com/gin-gonic/gin"
)
func (s *Server) handleRouteGet(c *gin.Context) {
ctx := c.Request.Context()
appName := c.MustGet(api.AppName).(string)
routePath := path.Clean("/" + c.MustGet(api.Path).(string))
route, err := s.Datastore().GetRoute(ctx, appName, routePath)
if err != nil {
handleErrorResponse(c, err)
return
}
c.JSON(http.StatusOK, routeResponse{"Successfully loaded route", route})
}