code: func (s *Service) ServeDatastore(w http.ResponseWriter, r *http.Request) {
  	ds, ferr := s.findDatastore(r.URL.Query())
  	if ferr != nil {
  		log.Printf("failed to locate datastore with query params: %s", r.URL.RawQuery)
  		w.WriteHeader(http.StatusNotFound)
  		return
  	}
  
  	r.URL.Path = strings.TrimPrefix(r.URL.Path, folderPrefix)
  	p := path.Join(ds.Info.GetDatastoreInfo().Url, r.URL.Path)
  
  	switch r.Method {
  	case http.MethodPost:
  		_, err := os.Stat(p)
  		if err == nil {
  			// File exists
  			w.WriteHeader(http.StatusConflict)
  			return
  		}
  
  		// File does not exist, fallthrough to create via PUT logic
  		fallthrough
  	case http.MethodPut:
  		dir := path.Dir(p)
  		_ = os.MkdirAll(dir, 0700)
  
  		f, err := os.Create(p)
  		if err != nil {
  			log.Printf("failed to %s '%s': %s", r.Method, p, err)
  			w.WriteHeader(http.StatusInternalServerError)
  			return
  		}
  		defer f.Close()
  
  		_, _ = io.Copy(f, r.Body)
  	default:
  		fs := http.FileServer(http.Dir(ds.Info.GetDatastoreInfo().Url))
  
  		fs.ServeHTTP(w, r)
  	}
  }
docs: // ServeDatastore handler for Datastore access via /folder path.