add user routes

This commit is contained in:
2026-09-04 23:03:50 +08:00
parent a28c1dec9b
commit e79282d8cc
13 changed files with 583 additions and 11 deletions

View File

@@ -8,11 +8,14 @@ import (
func PathOf() string {
_, file, _, _ := runtime.Caller(1)
idx := strings.Index(file, "routes/")
path := file[idx+len("routes"):]
path = strings.TrimSuffix(path, ".go")
if strings.HasSuffix(path, "/index") {
path = strings.TrimSuffix(path, "index")
}
re := regexp.MustCompile(`param_(\w+)`)
path = re.ReplaceAllString(path, ":$1")