Add proper logfile support
Some checks are pending
/ test (push) Waiting to run

This commit is contained in:
Melody Becker 2025-04-08 17:29:28 +02:00
parent 28a4f4121e
commit 98191fd098
Signed by: mstar
SSH key fingerprint: SHA256:9VAo09aaVNTWKzPW7Hq2LW+ox9OdwmTSHRoD4mlz1yI
7 changed files with 112 additions and 11 deletions

View file

@ -26,8 +26,33 @@
// TODO: Decide how long the Linstrom-RPC API will remain backwards compatible
package webpublic
import "net/http"
import (
"context"
"fmt"
"net/http"
)
type Server struct {
server http.Server
server *http.Server
}
func New(addr string) *Server {
handler := http.NewServeMux()
handler.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(500)
fmt.Fprint(w, "not implemented")
})
server := http.Server{
Handler: handler,
Addr: addr,
}
return &Server{&server}
}
func (s *Server) Start() error {
return s.server.ListenAndServe()
}
func (s *Server) Stop() error {
return s.server.Shutdown(context.Background())
}