summaryrefslogtreecommitdiffstats
path: root/cmd/web/main.go
diff options
context:
space:
mode:
authorMatthew Lemon <y@yulqen.org>2024-02-08 16:54:02 +0000
committerMatthew Lemon <y@yulqen.org>2024-02-08 16:54:02 +0000
commitced9bbed371d7a1d7692c820f80c77f43ebd32a3 (patch)
tree896ef80f261b81049ac18797e7b0c3ae89c0837f /cmd/web/main.go
parent4bcba90a1a78cac4ec2ed370bb751d95717b7120 (diff)
Created a /organisations/list route
There is also some basic CSS here. Also introduced a proper structured logger.
Diffstat (limited to 'cmd/web/main.go')
-rw-r--r--cmd/web/main.go14
1 files changed, 11 insertions, 3 deletions
diff --git a/cmd/web/main.go b/cmd/web/main.go
index bd7e500..d388364 100644
--- a/cmd/web/main.go
+++ b/cmd/web/main.go
@@ -2,16 +2,24 @@ package main
import (
"log"
+ "log/slog"
"net/http"
+ "os"
)
-type application struct{}
+type application struct {
+ logger *slog.Logger
+}
func main() {
- app := &application{}
+ logger := slog.New(slog.NewTextHandler(os.Stdout, nil))
+ app := &application{
+ logger: logger,
+ }
// mux := http.NewServeMux()
// mux.HandleFunc("/", home)
- log.Print("starting server on :4000")
+ // log.Print("starting server on :4000")
+ logger.Info("starting server on :4000")
err := http.ListenAndServe(":4000", app.routes())
log.Fatal(err)
}