You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
698 B
Go

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
}