✨ Add broker-service
This commit is contained in:
parent
2796d816e8
commit
60aeac4f4b
5 changed files with 90 additions and 0 deletions
24
broker-service/cmd/api/handlers.go
Normal file
24
broker-service/cmd/api/handlers.go
Normal 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)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue