Restructure the monorepo into clear top-level directories: - backend/: Go module root (cmd, internal, pkg, configs, migrations, docs/swagger, scripts, tests, go.mod, Makefile, .air.toml) - deploy/: Docker (Dockerfile, docker-compose*), quickstart, fluentd - docs/: project documentation + reports/ (moved from repo root) - AGENTS.md: new AI coding-agent guide at repo root Update all references to the new layout: - Dockerfile: COPY backend/go.mod, COPY backend/ (context = repo root) - docker-compose files: context ../.., dockerfile deploy/docker/Dockerfile, env_file ../../.env, volume mounts ../../backend:/app - deploy/quickstart/compose.yaml: dockerfile deploy/docker/Dockerfile - CI: working-directory: backend for go commands, file deploy/docker/Dockerfile, coverage path backend/coverage.out, health_check backend/scripts/ - backend/Makefile: docker target uses -f ../deploy/docker/Dockerfile ../ - README: architecture tree, quickstart, config paths updated Move root stray scripts (rename_models.*, run_m11_tests.sh, verify_build.sh, gorm_bool_main.go) to backend/scripts/legacy/. All moves via git mv to preserve history. Build, vet, SQLite tests, and docker compose config verified.
61 lines
1.2 KiB
Go
61 lines
1.2 KiB
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"sort"
|
|
"strings"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
"github.com/gochat/gochat/internal/config"
|
|
v1 "github.com/gochat/gochat/internal/handler/api/v1"
|
|
"github.com/gochat/gochat/internal/middleware"
|
|
"github.com/gochat/gochat/internal/router"
|
|
)
|
|
|
|
func main() {
|
|
gin.SetMode(gin.TestMode)
|
|
engine := gin.New()
|
|
|
|
cfg, err := config.Load()
|
|
if err != nil {
|
|
fmt.Fprintf(os.Stderr, "config load: %v\n", err)
|
|
os.Exit(1)
|
|
}
|
|
|
|
// Create mostly zero-value handlers — we only need route paths, not working handlers.
|
|
handlers := &router.Handlers{EnterpriseAccount: v1.NewEnterpriseAccountHandler(nil)}
|
|
|
|
corsCfg := middleware.CORSConfigFromAppConfig(cfg)
|
|
router.RegisterRoutes(
|
|
engine,
|
|
nil, // jwtService
|
|
nil, // refreshStore
|
|
nil, // webhookRegistry
|
|
handlers,
|
|
nil, // hub
|
|
nil, // wsAuthenticator
|
|
&cfg.JWT,
|
|
corsCfg,
|
|
nil, // db
|
|
)
|
|
|
|
routes := engine.Routes()
|
|
sort.Slice(routes, func(i, j int) bool {
|
|
if routes[i].Method != routes[j].Method {
|
|
return routes[i].Method < routes[j].Method
|
|
}
|
|
return routes[i].Path < routes[j].Path
|
|
})
|
|
|
|
count := 0
|
|
for _, r := range routes {
|
|
if strings.HasPrefix(r.Path, "/swagger") {
|
|
continue
|
|
}
|
|
fmt.Printf("%s %s\n", r.Method, r.Path)
|
|
count++
|
|
}
|
|
fmt.Printf("TOTAL: %d\n", count)
|
|
}
|