refactor(10.2-01): nest framework packages under modules
- Move remaining beach packages and embedded admin assets\n- Rewrite framework, example, build, and gate paths
This commit is contained in:
30
modules/surf/routetable.go
Normal file
30
modules/surf/routetable.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package surf
|
||||
|
||||
// RouteInfo is a read-only snapshot of one registered route after Assemble
|
||||
// or BuildRouter.
|
||||
type RouteInfo struct {
|
||||
Method string
|
||||
Pattern string
|
||||
PluginID string
|
||||
Middleware []string
|
||||
Raw bool
|
||||
}
|
||||
|
||||
// Routes returns a defensive copy of every registered route.
|
||||
func (r *Router) Routes() []RouteInfo {
|
||||
if r == nil {
|
||||
return nil
|
||||
}
|
||||
out := make([]RouteInfo, len(r.routes))
|
||||
for i, rt := range r.routes {
|
||||
mw := append([]string{}, rt.middleware...)
|
||||
out[i] = RouteInfo{
|
||||
Method: rt.method,
|
||||
Pattern: rt.path,
|
||||
PluginID: rt.pluginID,
|
||||
Middleware: mw,
|
||||
Raw: rt.raw,
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
Reference in New Issue
Block a user