45 lines
		
	
	
		
			946 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			45 lines
		
	
	
		
			946 B
		
	
	
	
		
			Go
		
	
	
	
	
	
package demohttp
 | 
						|
 | 
						|
import (
 | 
						|
	"context"
 | 
						|
	"net/http"
 | 
						|
 | 
						|
	"gitea.libretechconsulting.com/rmcguire/go-app/pkg/srv/http/opts"
 | 
						|
 | 
						|
	"gitea.libretechconsulting.com/rmcguire/go-http-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
 | 
						|
		},
 | 
						|
	}
 | 
						|
}
 |