Is http.StripPrefix necessary when serving static files in Go?

Viewed 1005

What's wrong with http.Handle("/static/", http.FileServer(http.Dir("")))?

The shortest example I can find looks like this:

fs := http.FileServer(http.Dir("static"))
http.Handle("/static/", http.StripPrefix("/static/", fs))

Is http.StripPrefix necessary?

1 Answers
Related