summaryrefslogtreecommitdiff
path: root/server.go
diff options
context:
space:
mode:
Diffstat (limited to 'server.go')
-rw-r--r--server.go16
1 files changed, 7 insertions, 9 deletions
diff --git a/server.go b/server.go
index 0c26188..685e2a5 100644
--- a/server.go
+++ b/server.go
@@ -13,14 +13,12 @@ import (
"github.com/gorilla/mux"
)
-type Server struct {
- backend *http.Server
-}
+type Server http.Server
//go:embed view/static/simple.css/simple.css view/static/ceres.js
var static embed.FS
-func NewServer(addr string, db *model.DB) Server {
+func NewServer(addr string, db *model.DB) *Server {
var r *mux.Router = mux.NewRouter()
r.PathPrefix("/static/").
@@ -49,15 +47,15 @@ func NewServer(addr string, db *model.DB) Server {
log.Printf("Configured server to listen on http://%s\n", srv.Addr)
- return Server{backend: &srv}
+ return (*Server)(&srv)
}
-func (s Server) Start() {
- s.backend.ListenAndServe()
+func (s *Server) Start() {
+ (*http.Server)(s).ListenAndServe()
}
-func (s Server) Stop() {
- err := s.backend.Shutdown(context.Background())
+func (s *Server) Stop() {
+ err := (*http.Server)(s).Shutdown(context.Background())
if err != nil {
log.Printf("Failed to shutdown HTTP server: %v\n", err)
} else {