spbooks / go1

Code archive for the book Level Up Your Web Apps With Go
109 stars 53 forks source link

CSS files are not served. #10

Open cydside opened 8 years ago

cydside commented 8 years ago

Hi, in chapter4/4_httprouter/main.go the line

http.Handle("/assets/", http.StripPrefix("/assets/", http.FileServer(http.Dir("assets/"))))

even if I use the following code:

filesRourter := NewRouter()
filesRourter.ServeFiles("/assets/css/*filepath", http.Dir("assets/"))

doesn't allow the browser to access the css files, the pase has not a style. I'm using go1.7.1 and the httprouter last commit is 4563b0b. Could you please fix it? Thanks