Add initial project files
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"docker-manager/docker"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func InfoHandler(w http.ResponseWriter, r *http.Request, client *docker.Client) {
|
||||
var info map[string]interface{}
|
||||
if err := client.GetJSON("/info", &info); err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
json.NewEncoder(w).Encode(info)
|
||||
}
|
||||
Reference in New Issue
Block a user