okospaceapi/pkg/api/server.go
Aaron Fischer 162d1cc00c
All checks were successful
/ docker-image (push) Successful in 1m30s
/ deployment (push) Successful in 0s
Add a wheel of fortune and fix json errors
2024-01-24 11:45:19 +01:00

17 lines
371 B
Go

package api
import "net/http"
func StartServer() {
err := http.ListenAndServe(":8080", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
_, err := w.Write(BuildDefinition())
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
}
}))
if err != nil {
panic(err)
}
}