createStaticHandler() — gin Function Reference
Architecture documentation for the createStaticHandler() function in routergroup.go from the gin codebase.
Entity Profile
Dependency Diagram
graph TD 9b868e6d_3117_438b_b3c3_0ac0d7b6b61a["createStaticHandler()"] 1d9080b1_eec3_bb36_4e07_d20ee3dad994["StaticFS()"] 1d9080b1_eec3_bb36_4e07_d20ee3dad994 -->|calls| 9b868e6d_3117_438b_b3c3_0ac0d7b6b61a cbe58699_430c_c923_47a5_d8708be7f7ab["calculateAbsolutePath()"] 9b868e6d_3117_438b_b3c3_0ac0d7b6b61a -->|calls| cbe58699_430c_c923_47a5_d8708be7f7ab style 9b868e6d_3117_438b_b3c3_0ac0d7b6b61a fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
routergroup.go lines 216–239
func (group *RouterGroup) createStaticHandler(relativePath string, fs http.FileSystem) HandlerFunc {
absolutePath := group.calculateAbsolutePath(relativePath)
fileServer := http.StripPrefix(absolutePath, http.FileServer(fs))
return func(c *Context) {
if _, noListing := fs.(*OnlyFilesFS); noListing {
c.Writer.WriteHeader(http.StatusNotFound)
}
file := c.Param("filepath")
// Check if file exists and/or if we have permission to access it
f, err := fs.Open(file)
if err != nil {
c.Writer.WriteHeader(http.StatusNotFound)
c.handlers = group.engine.noRoute
// Reset index
c.index = -1
return
}
f.Close()
fileServer.ServeHTTP(c.Writer, c.Request)
}
}
Domain
Subdomains
Calls
Called By
Source
Frequently Asked Questions
What does createStaticHandler() do?
createStaticHandler() is a function in the gin codebase.
What does createStaticHandler() call?
createStaticHandler() calls 1 function(s): calculateAbsolutePath.
What calls createStaticHandler()?
createStaticHandler() is called by 1 function(s): StaticFS.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free