Created
August 5, 2015 19:08
-
-
Save GoesToEleven/7bf3e362c10249e3527e to your computer and use it in GitHub Desktop.
Golang Path Package - only serve files in certain directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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