package main import ( "net/http" "oko-spaceapi/pkg/spaceapi" ) //go:generate ../generate-spaceapi-types.sh func main() { definition := spaceapi.Root{ // TODO: Fill up with stuff ApiCompatibility: []string{"14"}, Links: []*spaceapi.LinksItems{ { Description: "Out main website", Name: "website", Url: "https://okoyono.de", }, }, Space: "økoyono", Url: "https://okoyono.de/", Contact: &spaceapi.Contact{ Email: "contact@okoyono.de", }, Location: &spaceapi.Location{ Address: "", }, } json, err := definition.MarshalJSON() if err != nil { panic(err) } err = http.ListenAndServe(":8080", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") _, err := w.Write(json) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) } })) if err != nil { panic(err) } }