summaryrefslogtreecommitdiff
path: root/server/cmd/main.go
diff options
context:
space:
mode:
authorMichael Hunteman <huntemanmt@gmail.com>2025-01-25 13:40:09 -0600
committerMichael Hunteman <huntemanmt@gmail.com>2025-01-25 13:40:09 -0600
commit417ce259cacea581ab84336f46d881558dd4b4fc (patch)
treede42013bcdfd29763d27e599f03bc01ca07bf1e4 /server/cmd/main.go
parent5713d1f4f04563fb96cbea8907cc1d8cdd3edbc2 (diff)
Containerize golang server with logging
Diffstat (limited to 'server/cmd/main.go')
-rw-r--r--server/cmd/main.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/server/cmd/main.go b/server/cmd/main.go
index 72d2aad..75caf19 100644
--- a/server/cmd/main.go
+++ b/server/cmd/main.go
@@ -12,12 +12,13 @@ import (
"git.huntm.net/wedding/server/admin"
"git.huntm.net/wedding/server/guest"
+ "git.huntm.net/wedding/server/middleware"
)
var (
user = "postgres"
password = os.Getenv("PASS")
- host = "localhost"
+ host = "host.containers.internal"
port = "5432"
database = "wedding"
)
@@ -38,7 +39,7 @@ func main() {
mux := http.NewServeMux()
mux.Handle("/api/guests/", guestHandler)
mux.Handle("/api/admin/", adminHandler)
- log.Fatal(http.ListenAndServe(":8080", serveHTTP(mux)))
+ log.Fatal(http.ListenAndServe(":8080", serveHTTP(middleware.LoggingMiddleware(mux))))
}
func serveHTTP(handler http.Handler) http.Handler {