App for fetching and uploading images to cloud bucket storage

This commit is contained in:
2022-12-10 15:27:24 +01:00
commit b56c3d1e29
18 changed files with 749 additions and 0 deletions

19
server/router.go Normal file
View File

@@ -0,0 +1,19 @@
package server
import (
"github.com/kevinmidboe/planetposen-images/server/handler"
)
const v1API string = "/api/v1"
func (s *Server) setupRoutes() {
s.Router.HandleFunc("/_healthz", handler.Healthz).Methods("GET").Name("Health")
api := s.Router.PathPrefix(v1API).Subrouter()
api.HandleFunc("/images", handler.UploadImages(s.Config.Hostname, s.GCSClient)).Methods("POST").Name("UploadImages")
api.HandleFunc("/images", handler.ListImages(s.GCSClient)).Methods("GET").Name("ListImages")
// Raw image fetcher
api.HandleFunc("/images/{path}", handler.FetchImage(s.GCSClient)).Methods("GET").Name("FetchImage")
}