func serveImageHandler(w http.ResponseWriter, r *http.Request) { vars := mux.Vars(r) blobKey := vars["id"] c := appengine.NewContext(r) fileStore := context.NewFileStore(c) fileStore.WriteFile(w, blobKey) }
func addImageHandler(w http.ResponseWriter, r *http.Request) { c := appengine.NewContext(r) fileStore := context.NewFileStore(c) _, imageKey := fileStore.GetUploadedFileKey(r, "file") service := NewService(c) recipeId := getRecipeId(r) service.AddImageToRecipe(recipeId, imageKey) img := Image{serveImageRoute(imageKey)} response.WriteJson(w, img) }
func NewService(c appengine.Context) Service { return &RepoWrapper{ context.NewFileStore(c), newRepositoryFromContext(c), } }