MCPcopy
hub / github.com/gin-gonic/gin / StaticFile

Method StaticFile

routergroup.go:166–170  ·  view source on GitHub ↗

StaticFile registers a single route in order to serve a single file of the local filesystem. router.StaticFile("favicon.ico", "./resources/favicon.ico")

(relativePath, filepath string)

Source from the content-addressed store, hash-verified

164// StaticFile registers a single route in order to serve a single file of the local filesystem.
165// router.StaticFile("favicon.ico", "./resources/favicon.ico")
166func (group *RouterGroup) StaticFile(relativePath, filepath string) IRoutes {
167 return group.staticFileHandler(relativePath, func(c *Context) {
168 c.File(filepath)
169 })
170}
171
172// StaticFileFS works just like `StaticFile` but a custom `http.FileSystem` can be used instead.
173// router.StaticFileFS("favicon.ico", "./resources/favicon.ico", Dir{".", false})

Callers

nothing calls this directly

Calls 2

staticFileHandlerMethod · 0.95
FileMethod · 0.80

Tested by

no test coverage detected