package internal import ( "log/slog" "net/http" ) // NewServer is responsible for all the top-level HTTP stuff that // applies to all endpoints, like CORS, auth middleware, and logging. // // in tests `nil` can be passed to components that will not be strictly // used. func NewServer(logger *slog.Logger, config *Config, // commentStore *commentStore // anotherStore *anotherStore ) http.Handler { mux := http.NewServeMux() addRoutes( mux, logger, config, // commentStore, // anotherStore, ) var handler http.Handler = mux // Add Middleware // handler = someMiddleware(handler) // handler = someMiddleware2(handler) // handler = someMiddleware3(handler) return handler }