github.com/wangyougui/gf/v2@v2.6.5/net/ghttp/ghttp_server_config_route.go (about)

     1  // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
     2  //
     3  // This Source Code Form is subject to the terms of the MIT License.
     4  // If a copy of the MIT was not distributed with this file,
     5  // You can obtain one at https://github.com/wangyougui/gf.
     6  
     7  package ghttp
     8  
     9  // SetRewrite sets rewrites for static URI for server.
    10  func (s *Server) SetRewrite(uri string, rewrite string) {
    11  	s.config.Rewrites[uri] = rewrite
    12  }
    13  
    14  // SetRewriteMap sets the rewritten map for server.
    15  func (s *Server) SetRewriteMap(rewrites map[string]string) {
    16  	for k, v := range rewrites {
    17  		s.config.Rewrites[k] = v
    18  	}
    19  }
    20  
    21  // SetRouteOverWrite sets the RouteOverWrite for server.
    22  func (s *Server) SetRouteOverWrite(enabled bool) {
    23  	s.config.RouteOverWrite = enabled
    24  }