generated from rmcguire/go-server-with-otel
Initial commit
This commit is contained in:
44
pkg/demohttp/server.go
Normal file
44
pkg/demohttp/server.go
Normal file
@ -0,0 +1,44 @@
|
||||
package demohttp
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"gitea.libretechconsulting.com/rmcguire/go-app/pkg/srv/http/opts"
|
||||
|
||||
"gitea.libretechconsulting.com/rmcguire/go-server-with-otel/pkg/config"
|
||||
)
|
||||
|
||||
type DemoHTTPServer struct {
|
||||
ctx context.Context
|
||||
cfg *config.DemoConfig
|
||||
}
|
||||
|
||||
func NewDemoHTTPServer(ctx context.Context, cfg *config.DemoConfig) *DemoHTTPServer {
|
||||
return &DemoHTTPServer{
|
||||
ctx: ctx,
|
||||
cfg: cfg,
|
||||
}
|
||||
}
|
||||
|
||||
func (dh *DemoHTTPServer) GetHandleFuncs() []opts.HTTPFunc {
|
||||
// TODO: Implement real http handle funcs
|
||||
return []opts.HTTPFunc{
|
||||
{
|
||||
Path: "/test",
|
||||
HandlerFunc: func(w http.ResponseWriter, r *http.Request) {
|
||||
w.WriteHeader(http.StatusNotImplemented)
|
||||
w.Write([]byte("unimplemented demo app"))
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (dh *DemoHTTPServer) GetHealthCheckFuncs() []opts.HealthCheckFunc {
|
||||
return []opts.HealthCheckFunc{
|
||||
func(ctx context.Context) error {
|
||||
// TODO: Implement real health checks
|
||||
return nil
|
||||
},
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user