Add two new webservers for new version
Some checks failed
/ test (push) Has been cancelled

One will be debug and localhost only, other one public stuff
This commit is contained in:
Melody Becker 2025-04-05 22:02:31 +02:00
parent 0cd5031e4e
commit 349e78e433
No known key found for this signature in database
2 changed files with 38 additions and 0 deletions

7
web-new/server.go Normal file
View file

@ -0,0 +1,7 @@
package web
import "net/http"
type Server struct {
server http.Server
}

31
webdebug/server.go Normal file
View file

@ -0,0 +1,31 @@
package webdebug
import (
"context"
"net/http"
)
const DebugAddr = "127.0.0.1:3305"
type Server struct {
server *http.Server
}
func New() *Server {
handler := http.NewServeMux()
web := http.Server{
Addr: DebugAddr,
Handler: handler,
}
return &Server{&web}
}
func (s *Server) Start() error {
if err := s.server.ListenAndServe(); err != nil && err != http.ErrServerClosed {
return err
}
return nil
}
func (s *Server) Stop() error {
return s.server.Shutdown(context.Background())
}