Esempio n. 1
0
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)
}
Esempio n. 2
0
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)
}
Esempio n. 3
0
func NewService(c appengine.Context) Service {
	return &RepoWrapper{
		context.NewFileStore(c),
		newRepositoryFromContext(c),
	}
}