Barebones HTTP server setup

This commit is contained in:
2025-02-03 22:28:50 +11:00
parent 07cd2e7507
commit 5c8d4c5158
9 changed files with 157 additions and 0 deletions

24
server.go Normal file
View File

@@ -0,0 +1,24 @@
package main
import (
"net/http"
"projectreshoot/middleware"
)
type Config struct {
Host string
Port string
}
func NewServer(
config *Config,
) http.Handler {
mux := http.NewServeMux()
addRoutes(
mux,
*config,
)
var handler http.Handler = mux
handler = middleware.Logging(handler)
return handler
}