build: /implement-task add-hello-endpoint T1
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
This commit is contained in:
parent
5b64c98da6
commit
7efb3c73f6
31
services/api/internal/api/handlers/hello.go
Normal file
31
services/api/internal/api/handlers/hello.go
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
package handlers
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"git.threesix.ai/jordan/feat-dev-e2e3/pkg/httpresponse"
|
||||||
|
"git.threesix.ai/jordan/feat-dev-e2e3/pkg/logging"
|
||||||
|
)
|
||||||
|
|
||||||
|
// HelloResponse is the data returned by GET /api/v1/hello.
|
||||||
|
type HelloResponse struct {
|
||||||
|
Message string `json:"message"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hello handles the hello greeting endpoint.
|
||||||
|
type Hello struct {
|
||||||
|
logger *logging.Logger
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewHello creates a new Hello handler.
|
||||||
|
func NewHello(logger *logging.Logger) *Hello {
|
||||||
|
return &Hello{logger: logger}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Say returns a greeting message.
|
||||||
|
func (h *Hello) Say(w http.ResponseWriter, r *http.Request) error {
|
||||||
|
httpresponse.OK(w, r, HelloResponse{
|
||||||
|
Message: "Hello, World!",
|
||||||
|
})
|
||||||
|
return nil
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user