Add broker-service

This commit is contained in:
Dan Jones 2025-05-16 15:35:44 -05:00
commit 60aeac4f4b
Signed by: dan
GPG key ID: 5B3B0F7217473A29
5 changed files with 90 additions and 0 deletions

View file

@ -0,0 +1,24 @@
package main
import (
"encoding/json"
"net/http"
)
type jsonResponse struct {
Error bool `json:"error`
Message string `json:"message"`
Data any `json:"data,omitempty"`
}
func (app *Config) Broker(w http.ResponseWriter, r *http.Request) {
payload := jsonResponse{
Error: false,
Message: "hit the broker",
}
out, _ := json.Marshal(payload)
w.Header().Set("Content-type", "application/json")
w.WriteHeader(http.StatusAccepted)
w.Write(out)
}