mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
26 lines
515 B
Go
26 lines
515 B
Go
package server
|
|
|
|
import (
|
|
"context"
|
|
"net/http"
|
|
"path"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
"github.com/kumokit/functions/api"
|
|
)
|
|
|
|
func (s *Server) handleRouteGet(c *gin.Context) {
|
|
ctx := c.MustGet("ctx").(context.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})
|
|
}
|