Browse Source

chore: refactor (#2130)

Kevin Wan 2 năm trước cách đây
mục cha
commit
3bad043413
1 tập tin đã thay đổi với 6 bổ sung4 xóa
  1. 6 4
      rest/server.go

+ 6 - 4
rest/server.go

@@ -79,13 +79,15 @@ func (s *Server) PrintRoutes() {
 	s.ngin.print()
 	s.ngin.print()
 }
 }
 
 
-// Routes returns the Http routers which are registered in the engine
+// Routes returns the HTTP routers that registered in the server.
 func (s *Server) Routes() []Route {
 func (s *Server) Routes() []Route {
-	routers := make([]Route, len(s.ngin.routes))
+	var routes []Route
+
 	for _, r := range s.ngin.routes {
 	for _, r := range s.ngin.routes {
-		routers = append(routers, r.routes...)
+		routes = append(routes, r.routes...)
 	}
 	}
-	return routers
+
+	return routes
 }
 }
 
 
 // Start starts the Server.
 // Start starts the Server.