Files
nfeeder/internal/web/server.go
T
jasonhilder a8862721cd Initial project structure commit.
Static directory for public folders and business logic for the app
within internal, split into domain specific folders to keep clear
seperation of concerns.
2026-04-23 08:09:09 +02:00

36 lines
497 B
Go

package web
import (
"context"
"net/http"
"nfeeder/internal/db"
)
type Server struct {
httpServer *http.Server
store *db.Store
}
func NewServer(store *db.Store) *Server {
s := &Server {
store: store,
}
s.httpServer = &http.Server {
Handler: s.setupRoutes(),
}
return s
}
func (s *Server) Start(addr string) error {
s.httpServer.Addr = addr
return s.httpServer.ListenAndServe()
}
func (s *Server) Shutdown(ctx context.Context) error {
return s.httpServer.Shutdown(ctx)
}