feat: print routes (#1964)
* feat: print rest routes * feat: print rest routes
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"sort"
|
||||
"time"
|
||||
|
||||
"github.com/justinas/alice"
|
||||
@@ -184,6 +185,22 @@ func (ng *engine) notFoundHandler(next http.Handler) http.Handler {
|
||||
})
|
||||
}
|
||||
|
||||
func (ng *engine) print() {
|
||||
var routes []string
|
||||
|
||||
for _, fr := range ng.routes {
|
||||
for _, route := range fr.routes {
|
||||
routes = append(routes, fmt.Sprintf("%s %s", route.Method, route.Path))
|
||||
}
|
||||
}
|
||||
|
||||
sort.Strings(routes)
|
||||
|
||||
for _, route := range routes {
|
||||
fmt.Println(route)
|
||||
}
|
||||
}
|
||||
|
||||
func (ng *engine) setTlsConfig(cfg *tls.Config) {
|
||||
ng.tlsConfig = cfg
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user