|
@ -18,12 +18,18 @@ type Metadata struct { |
|
|
|
|
|
|
|
|
func PipelineHandler(pipeline pipelines.IPipeline, w http.ResponseWriter, r *http.Request) { |
|
|
func PipelineHandler(pipeline pipelines.IPipeline, w http.ResponseWriter, r *http.Request) { |
|
|
w.Header().Set("Content-Type", "application/json") |
|
|
w.Header().Set("Content-Type", "application/json") |
|
|
json.NewEncoder(w).Encode(pipeline) |
|
|
|
|
|
|
|
|
err := json.NewEncoder(w).Encode(pipeline) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
w.WriteHeader(http.StatusInternalServerError) |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func IndexHandler(w http.ResponseWriter, r *http.Request) { |
|
|
func IndexHandler(w http.ResponseWriter, r *http.Request) { |
|
|
w.Header().Set("Content-Type", "application/json") |
|
|
w.Header().Set("Content-Type", "application/json") |
|
|
json.NewEncoder(w).Encode(Metadata{Name, Version}) |
|
|
|
|
|
|
|
|
err := json.NewEncoder(w).Encode(Metadata{Name, Version}) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
w.WriteHeader(http.StatusInternalServerError) |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func RegisterPipelineRoutes(r *mux.Router, pipelines []pipelines.IPipeline) { |
|
|
func RegisterPipelineRoutes(r *mux.Router, pipelines []pipelines.IPipeline) { |
|
@ -42,5 +48,8 @@ func main() { |
|
|
|
|
|
|
|
|
RegisterPipelineRoutes(r, pipes) |
|
|
RegisterPipelineRoutes(r, pipes) |
|
|
|
|
|
|
|
|
http.ListenAndServe(":8000", r) |
|
|
|
|
|
|
|
|
err := http.ListenAndServe(":8000", r) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
panic(err) |
|
|
|
|
|
} |
|
|
} |
|
|
} |