add http handle
This commit is contained in:
parent
76197bce6f
commit
9393518045
|
@ -90,6 +90,12 @@ func (s *Server) Use(middlewares ...middleware.Middleware) {
|
||||||
s.middlewares = append(s.middlewares, middlewares...)
|
s.middlewares = append(s.middlewares, middlewares...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *Server) Handle(method string, uri string, handler http.HandlerFunc) {
|
||||||
|
s.engine.Handle(method, uri, func(ctx *gin.Context) {
|
||||||
|
handler(ctx.Writer, ctx.Request)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
func (s *Server) Webroot(prefix string, fs http.FileSystem) {
|
func (s *Server) Webroot(prefix string, fs http.FileSystem) {
|
||||||
s.fs = newFS(time.Now(), fs)
|
s.fs = newFS(time.Now(), fs)
|
||||||
s.fs.SetPrefix(prefix)
|
s.fs.SetPrefix(prefix)
|
||||||
|
|
Loading…
Reference in New Issue