github.com/iron-io/functions@v0.0.0-20180820112432-d59d7d1c40b2/api/server/apps_get.go (about)

     1  package server
     2  
     3  import (
     4  	"context"
     5  	"net/http"
     6  
     7  	"github.com/gin-gonic/gin"
     8  	"github.com/iron-io/functions/api"
     9  )
    10  
    11  func (s *Server) handleAppGet(c *gin.Context) {
    12  	ctx := c.MustGet("ctx").(context.Context)
    13  
    14  	appName := c.MustGet(api.AppName).(string)
    15  	app, err := s.Datastore.GetApp(ctx, appName)
    16  	if err != nil {
    17  		handleErrorResponse(c, err)
    18  		return
    19  	}
    20  
    21  	c.JSON(http.StatusOK, appResponse{"Successfully loaded app", app})
    22  }