gitee.com/liuxuezhan/go-micro-v1.18.0@v1.0.0/api/handler/file/file.go (about)

     1  // Package file serves file relative to the current directory
     2  package file
     3  
     4  import (
     5  	"net/http"
     6  )
     7  
     8  type Handler struct{}
     9  
    10  func (h *Handler) Serve(w http.ResponseWriter, r *http.Request) {
    11  	http.ServeFile(w, r, "."+r.URL.Path)
    12  }
    13  
    14  func (h *Handler) String() string {
    15  	return "file"
    16  }