summaryrefslogtreecommitdiffstats
path: root/cmd/web
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/web')
-rw-r--r--cmd/web/main.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/cmd/web/main.go b/cmd/web/main.go
index d388364..a4082fd 100644
--- a/cmd/web/main.go
+++ b/cmd/web/main.go
@@ -1,6 +1,7 @@
package main
import (
+ "flag"
"log"
"log/slog"
"net/http"
@@ -12,6 +13,10 @@ type application struct {
}
func main() {
+ addr := flag.String("addr", ":4000", "HTTP network port")
+ // dsn := flag.String("dsn", "web:dedpassword:/ded?parseTime=true", "MySQL data source name")
+ flag.Parse()
+
logger := slog.New(slog.NewTextHandler(os.Stdout, nil))
app := &application{
logger: logger,
@@ -19,7 +24,7 @@ func main() {
// mux := http.NewServeMux()
// mux.HandleFunc("/", home)
// log.Print("starting server on :4000")
- logger.Info("starting server on :4000")
- err := http.ListenAndServe(":4000", app.routes())
+ logger.Info("starting server", "addr", *addr)
+ err := http.ListenAndServe(*addr, app.routes())
log.Fatal(err)
}