Skip to content

Instantly share code, notes, and snippets.

@GoesToEleven
Created August 5, 2015 19:08
Show Gist options
  • Save GoesToEleven/7bf3e362c10249e3527e to your computer and use it in GitHub Desktop.
Save GoesToEleven/7bf3e362c10249e3527e to your computer and use it in GitHub Desktop.
Golang Path Package - only serve files in certain directory
if path.Dir(req.URL.Path) == "/public/favicons" {
fname := path.Base(req.URL.Path)
http.ServeFile(res, req, "./public/favicons/"+fname)
return
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment