refactor(api): restructure existing routes and remove unused debug endpoints and command line arguments

This commit is contained in:
yusing
2025-05-10 13:12:41 +08:00
parent 26938eb6ed
commit 198ae2cd02
13 changed files with 180 additions and 294 deletions

View File

@@ -0,0 +1,23 @@
package v1
import (
"net/http"
config "github.com/yusing/go-proxy/internal/config/types"
"github.com/yusing/go-proxy/internal/net/gphttp"
"github.com/yusing/go-proxy/internal/route/routes"
)
func ListRouteHandler(cfg config.ConfigInstance, w http.ResponseWriter, r *http.Request) {
which := r.PathValue("which")
if which == "" || which == "all" {
gphttp.RespondJSON(w, r, routes.ByAlias())
return
}
routesMap := routes.ByAlias()
if route, ok := routesMap[which]; ok {
gphttp.RespondJSON(w, r, route)
} else {
gphttp.RespondJSON(w, r, nil)
}
}