You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

14 lines
297 B

  1. package handlers
  2. import (
  3. "net/http"
  4. )
  5. // StaticFileHandler, unlike net/http.FileServer, serves the contents of a specific
  6. // file when it is called.
  7. func StaticFileHandler(path string) http.HandlerFunc {
  8. return func(w http.ResponseWriter, r *http.Request) {
  9. http.ServeFile(w, r, path)
  10. }
  11. }