Static path

This commit is contained in:
Ian Gulliver
2024-11-21 19:30:11 -08:00
parent 9e43e5c39e
commit 1b1a191551

View File

@@ -7,11 +7,11 @@ import (
) )
func main() { func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { // http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello! you've requested %s\n", r.URL.Path) // fmt.Fprintf(w, "Hello! you've requested %s\n", r.URL.Path)
}) // })
http.Handle("/static", http.FileServer(http.Dir("./static"))) http.Handle("/", http.FileServer(http.Dir("./static")))
port := os.Getenv("PORT") port := os.Getenv("PORT")
if port == "" { if port == "" {