Adding helper functions to router group for LINK and UNLINK.

This commit is contained in:
Jamie Stackhouse 2014-12-15 13:19:51 -04:00
parent dcad0df8f7
commit a48f83c9a1
1 changed files with 12 additions and 1 deletions

View File

@ -5,9 +5,10 @@
package gin
import (
"github.com/julienschmidt/httprouter"
"net/http"
"path"
"github.com/julienschmidt/httprouter"
)
// Used internally to configure router, a RouterGroup is associated with a prefix
@ -95,6 +96,16 @@ func (group *RouterGroup) HEAD(relativePath string, handlers ...HandlerFunc) {
group.Handle("HEAD", relativePath, handlers)
}
// LINK is a shortcut for router.Handle("LINK", path, handle)
func (group *RouterGroup) LINK(relativePath string, handlers ...HandlerFunc) {
group.Handle("LINK", relativePath, handlers)
}
// UNLINK is a shortcut for router.Handle("UNLINK", path, handle)
func (group *RouterGroup) UNLINK(relativePath string, handlers ...HandlerFunc) {
group.Handle("UNLINK", relativePath, handlers)
}
// 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.