mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-31 12:12:25 -05:00 
			
		
		
		
	rename r router
This commit is contained in:
		
					parent
					
						
							
								f1cdfe6a54
							
						
					
				
			
			
				commit
				
					
						4eb35078b9
					
				
			
		
					 1 changed files with 7 additions and 7 deletions
				
			
		|  | @ -62,23 +62,23 @@ func (r *router) Start() { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // Stop shuts down the router nicely | // Stop shuts down the router nicely | ||||||
| func (s *router) Stop(ctx context.Context) error { | func (r *router) Stop(ctx context.Context) error { | ||||||
| 	return s.srv.Shutdown(ctx) | 	return r.srv.Shutdown(ctx) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // AttachHandler attaches the given gin.HandlerFunc to the router with the specified method and path. | // AttachHandler attaches the given gin.HandlerFunc to the router with the specified method and path. | ||||||
| // If the path is set to ANY, then the handlerfunc will be used for ALL methods at its given path. | // If the path is set to ANY, then the handlerfunc will be used for ALL methods at its given path. | ||||||
| func (s *router) AttachHandler(method string, path string, handler gin.HandlerFunc) { | func (r *router) AttachHandler(method string, path string, handler gin.HandlerFunc) { | ||||||
| 	if method == "ANY" { | 	if method == "ANY" { | ||||||
| 		s.engine.Any(path, handler) | 		r.engine.Any(path, handler) | ||||||
| 	} else { | 	} else { | ||||||
| 		s.engine.Handle(method, path, handler) | 		r.engine.Handle(method, path, handler) | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // AttachMiddleware attaches a gin middleware to the router that will be used globally | // AttachMiddleware attaches a gin middleware to the router that will be used globally | ||||||
| func (s *router) AttachMiddleware(middleware gin.HandlerFunc) { | func (r *router) AttachMiddleware(middleware gin.HandlerFunc) { | ||||||
| 	s.engine.Use(middleware) | 	r.engine.Use(middleware) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // New returns a new Router with the specified configuration, using the given logrus logger. | // New returns a new Router with the specified configuration, using the given logrus logger. | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue