url-shortener: vendor pico.css
diff --git a/apps/url-shortener/main.go b/apps/url-shortener/main.go
index 8f2af45..71cf488 100644
--- a/apps/url-shortener/main.go
+++ b/apps/url-shortener/main.go
@@ -15,11 +15,15 @@
"github.com/mattn/go-sqlite3"
)
+var port = flag.Int("port", 8080, "Port to listen on")
var dbPath = flag.String("db-path", "url-shortener.db", "Path to the SQLite file")
//go:embed index.html
var indexHTML embed.FS
+//go:embed static/*
+var f embed.FS
+
type NamedAddress struct {
Name string
Address string
@@ -160,9 +164,10 @@
}
func (s *Server) Start() {
+ http.Handle("/static/", http.FileServer(http.FS(f)))
http.HandleFunc("/", s.handler)
http.HandleFunc("/api/update/", s.toggleHandler)
- log.Fatal(http.ListenAndServe(":8080", nil))
+ log.Fatal(http.ListenAndServe(fmt.Sprintf(":%d", *port), nil))
}
func (s *Server) handler(w http.ResponseWriter, r *http.Request) {