Skip to content

Commit 388c20d

Browse files
make localhost:8080/dog/ work
1 parent 2bdef48 commit 388c20d

File tree

1 file changed

+2
-2
lines changed
  • 023_serving-files/02_serving/04_FileServer/01

1 file changed

+2
-2
lines changed

023_serving-files/02_serving/04_FileServer/01/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ import (
77

88
func main() {
99
http.Handle("/", http.FileServer(http.Dir(".")))
10-
http.HandleFunc("/dog", dog)
10+
http.HandleFunc("/dog/", dog)
1111
http.ListenAndServe(":8080", nil)
1212
}
1313

1414
func dog(w http.ResponseWriter, req *http.Request) {
1515
w.Header().Set("Content-Type", "text/html; charset=utf-8")
16-
io.WriteString(w, `<img src="toby.jpg">`)
16+
io.WriteString(w, `<img src="/toby.jpg">`)
1717
}

0 commit comments

Comments
 (0)