package server import ( "backend/core" "backend/util" "net/http" ) func getphotolist(w http.ResponseWriter, r *http.Request) { if r.Method != "GET" { util.Logformat(util.ERROR, "%s: Only GET is accepted (%s received)", util.GetFunctionName(), r.Method) http.Error(w, "Only GET method is accepted", http.StatusBadRequest) } else { sendResponse(w, core.GetPictureData()) } } func getphoto(w http.ResponseWriter, r *http.Request) { if r.Method != "GET" { util.Logformat(util.ERROR, "%s: Only GET is accepted (%s received)", util.GetFunctionName(), r.Method) http.Error(w, "Only GET method is accepted", http.StatusBadRequest) } else { util_config := util.GetConfig() http.StripPrefix("/photo/", http.FileServer(http.Dir(util_config.PhotoPath))).ServeHTTP(w, r) } } func getphoto_compressed(w http.ResponseWriter, r *http.Request) { if r.Method != "GET" { util.Logformat(util.ERROR, "%s: Only GET is accepted (%s received)", util.GetFunctionName(), r.Method) http.Error(w, "Only GET method is accepted", http.StatusBadRequest) } else { util_config := util.GetConfig() http.StripPrefix("/photo_compressed/", http.FileServer(http.Dir(util_config.PhotoCompressPath))).ServeHTTP(w, r) } }