internal/api/router/router.go (14 lines of code) (raw):
package router
import (
"net/http"
"github.com/GoogleCloudPlatform/gcs-metadata-server/internal/api/handler"
"github.com/GoogleCloudPlatform/gcs-metadata-server/internal/repo"
)
func New(db *repo.Database) *http.ServeMux {
mux := http.NewServeMux()
exploreRepo := repo.NewExploreRepository(db)
exploreHandler := handler.NewExploreHandler(exploreRepo)
mux.HandleFunc("GET /explore/{path...}", exploreHandler.HandleExplore)
mux.HandleFunc("GET /summary/{path...}", exploreHandler.HandleSummary)
return mux
}