Skip to content
generated from clevergo/pkg-template

Shields is a Go SDK for creating shields.io endpoint.

License

Notifications You must be signed in to change notification settings

clevergo/shields

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shields.io Go SDK for creating an endpoint.

Build Status Coverage Status Go.Dev reference Go Report Card Release Downloads Chat Community

$ 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)
}

About

Shields is a Go SDK for creating shields.io endpoint.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages