add http handle

This commit is contained in:
Yavolte 2025-06-11 11:02:41 +08:00
parent 76197bce6f
commit 9393518045
1 changed files with 6 additions and 0 deletions

View File

@ -90,6 +90,12 @@ func (s *Server) Use(middlewares ...middleware.Middleware) {
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) {
s.fs = newFS(time.Now(), fs)
s.fs.SetPrefix(prefix)