Shields.io Go SDK for creating an endpoint.
$ go get -u clevergo.tech/shields
import (
"encoding/json"
"net/http"
"clevergo.tech/shields"
)
func handler(w http.ResponseWriter, req *http.Request) {
badge := shields.New("label", "message")
badge.LabelColor = shields.ColorBlue
err := badge.ParseRequest(req)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
data, err := json.Marshal(badge)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
w.Header().Set("Content-Type", "application/json")
w.Write(data)
}