Documentation ¶
Index ¶
- func Any(relativePath string, handlers ...gin.HandlerFunc) gin.IRoutes
- func DELETE(relativePath string, handlers ...gin.HandlerFunc) gin.IRoutes
- func GET(relativePath string, handlers ...gin.HandlerFunc) gin.IRoutes
- func Group(relativePath string, handlers ...gin.HandlerFunc) *gin.RouterGroup
- func HEAD(relativePath string, handlers ...gin.HandlerFunc) gin.IRoutes
- func Handle(httpMethod, relativePath string, handlers ...gin.HandlerFunc) gin.IRoutes
- func LoadHTMLFiles(files ...string)
- func LoadHTMLGlob(pattern string)
- func NoMethod(handlers ...gin.HandlerFunc)
- func NoRoute(handlers ...gin.HandlerFunc)
- func OPTIONS(relativePath string, handlers ...gin.HandlerFunc) gin.IRoutes
- func PATCH(relativePath string, handlers ...gin.HandlerFunc) gin.IRoutes
- func POST(relativePath string, handlers ...gin.HandlerFunc) gin.IRoutes
- func PUT(relativePath string, handlers ...gin.HandlerFunc) gin.IRoutes
- func Run(addr ...string) (err error)
- func RunTLS(addr, certFile, keyFile string) (err error)
- func RunUnix(file string) (err error)
- func SetHTMLTemplate(templ *template.Template)
- func Static(relativePath, root string) gin.IRoutes
- func StaticFS(relativePath string, fs http.FileSystem) gin.IRoutes
- func StaticFile(relativePath, filepath string) gin.IRoutes
- func Use(middlewares ...gin.HandlerFunc) gin.IRoutes
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DELETE ¶
func DELETE(relativePath string, handlers ...gin.HandlerFunc) gin.IRoutes
DELETE is a shortcut for router.Handle("DELETE", path, handle)
func GET ¶
func GET(relativePath string, handlers ...gin.HandlerFunc) gin.IRoutes
GET is a shortcut for router.Handle("GET", path, handle)
func Group ¶
func Group(relativePath string, handlers ...gin.HandlerFunc) *gin.RouterGroup
Group creates a new router group. You should add all the routes that have common middlwares or the same path prefix. For example, all the routes that use a common middlware for authorization could be grouped.
func HEAD ¶
func HEAD(relativePath string, handlers ...gin.HandlerFunc) gin.IRoutes
HEAD is a shortcut for router.Handle("HEAD", path, handle)
func LoadHTMLFiles ¶
func LoadHTMLFiles(files ...string)
func LoadHTMLGlob ¶
func LoadHTMLGlob(pattern string)
func NoMethod ¶
func NoMethod(handlers ...gin.HandlerFunc)
NoMethod sets the handlers called when... TODO
func NoRoute ¶
func NoRoute(handlers ...gin.HandlerFunc)
NoRoute adds handlers for NoRoute. It return a 404 code by default.
func OPTIONS ¶
func OPTIONS(relativePath string, handlers ...gin.HandlerFunc) gin.IRoutes
OPTIONS is a shortcut for router.Handle("OPTIONS", path, handle)
func PATCH ¶
func PATCH(relativePath string, handlers ...gin.HandlerFunc) gin.IRoutes
PATCH is a shortcut for router.Handle("PATCH", path, handle)
func POST ¶
func POST(relativePath string, handlers ...gin.HandlerFunc) gin.IRoutes
POST is a shortcut for router.Handle("POST", path, handle)
func PUT ¶
func PUT(relativePath string, handlers ...gin.HandlerFunc) gin.IRoutes
PUT is a shortcut for router.Handle("PUT", path, handle)
func Run ¶
Run : The router is attached to a http.Server and starts listening and serving HTTP requests. It is a shortcut for http.ListenAndServe(addr, router) Note: this method will block the calling goroutine undefinitelly unless an error happens.
func RunTLS ¶
RunTLS : The router is attached to a http.Server and starts listening and serving HTTPS requests. It is a shortcut for http.ListenAndServeTLS(addr, certFile, keyFile, router) Note: this method will block the calling goroutine undefinitelly unless an error happens.
func RunUnix ¶
RunUnix : The router is attached to a http.Server and starts listening and serving HTTP requests through the specified unix socket (ie. a file) Note: this method will block the calling goroutine undefinitelly unless an error happens.
func SetHTMLTemplate ¶
func Static ¶
Static serves files from the given file system root. Internally a http.FileServer is used, therefore http.NotFound is used instead of the Router's NotFound handler. To use the operating system's file system implementation, use :
router.Static("/static", "/var/www")
func StaticFile ¶
func Use ¶
func Use(middlewares ...gin.HandlerFunc) gin.IRoutes
Use attachs a global middleware to the router. ie. the middlewares attached though Use() will be included in the handlers chain for every single request. Even 404, 405, static files... For example, this is the right place for a logger or error management middleware.
Types ¶
This section is empty.