24 lines
470 B
Go
24 lines
470 B
Go
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)
|
|
}
|