|
@ -132,11 +132,16 @@ func UploadHandler(w http.ResponseWriter, r *http.Request, pipes []pipelines.IPi |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func RegisterRoutes(r *mux.Router, pipelines []pipelines.IPipeline, storageProvider storage.IStorageProvider) { |
|
|
func RegisterRoutes(r *mux.Router, pipelines []pipelines.IPipeline, storageProvider storage.IStorageProvider) { |
|
|
r.HandleFunc("/", IndexHandler).Methods("GET") |
|
|
|
|
|
r.HandleFunc("/upload", func(w http.ResponseWriter, r *http.Request) { |
|
|
|
|
|
|
|
|
index := r.Methods(http.MethodGet).Subrouter() |
|
|
|
|
|
index.HandleFunc("/", IndexHandler) |
|
|
|
|
|
|
|
|
|
|
|
upload := r.Methods(http.MethodPost).Subrouter() |
|
|
|
|
|
upload.HandleFunc("/upload", func(w http.ResponseWriter, r *http.Request) { |
|
|
UploadHandler(w, r, pipelines, storageProvider) |
|
|
UploadHandler(w, r, pipelines, storageProvider) |
|
|
}).Methods("POST") |
|
|
|
|
|
r.HandleFunc("/pipelines/{pipeline}", func(w http.ResponseWriter, r *http.Request) { |
|
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
pipeline := r.Methods(http.MethodGet).Subrouter() |
|
|
|
|
|
pipeline.HandleFunc("/pipelines/{pipeline}", func(w http.ResponseWriter, r *http.Request) { |
|
|
for _, pipeline := range pipelines { |
|
|
for _, pipeline := range pipelines { |
|
|
if pipeline.GetSlug() == mux.Vars(r)["pipeline"] { |
|
|
if pipeline.GetSlug() == mux.Vars(r)["pipeline"] { |
|
|
PipelineHandler(pipeline, storageProvider, w, r) |
|
|
PipelineHandler(pipeline, storageProvider, w, r) |
|
@ -145,7 +150,7 @@ func RegisterRoutes(r *mux.Router, pipelines []pipelines.IPipeline, storageProvi |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
w.WriteHeader(404) |
|
|
w.WriteHeader(404) |
|
|
}).Methods("GET") |
|
|
|
|
|
|
|
|
}) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func main() { |
|
|
func main() { |
|
|