feat:Add Routes method for server (#2125)
Co-authored-by: czyt <czyt@w.cn>
This commit is contained in:
@@ -79,6 +79,15 @@ func (s *Server) PrintRoutes() {
|
||||
s.ngin.print()
|
||||
}
|
||||
|
||||
// Routes returns the Http routers which are registered in the engine
|
||||
func (s *Server) Routes() []Route {
|
||||
routers := make([]Route, len(s.ngin.routes))
|
||||
for _, r := range s.ngin.routes {
|
||||
routers = append(routers, r.routes...)
|
||||
}
|
||||
return routers
|
||||
}
|
||||
|
||||
// Start starts the Server.
|
||||
// Graceful shutdown is enabled by default.
|
||||
// Use proc.SetTimeToForceQuit to customize the graceful shutdown period.
|
||||
|
||||
Reference in New Issue
Block a user