Refactor server package structure and update error handling methods; remove unused dependencies

This commit is contained in:
alex
2025-06-22 11:54:16 +03:00
parent eaff815270
commit 0d8673254e
9 changed files with 32 additions and 21 deletions

View File

@@ -7,6 +7,7 @@ import (
"github.com/akyaiy/GoSally-mvp/internal/config"
"github.com/akyaiy/GoSally-mvp/internal/logs"
"github.com/akyaiy/GoSally-mvp/internal/server/v1"
"github.com/go-chi/chi/v5"
)
@@ -27,15 +28,16 @@ func init() {
}
func main() {
r := chi.NewRouter()
r.Route("/v1/com", func(r chi.Router) {
r.Get("/", handleV1ComList)
r.Get("/{cmd}", handleV1)
})
r.Route("/v2/com", func(r chi.Router) {
r.Get("/", handleV1ComList)
r.Get("/{cmd}", handleV1)
})
// r.Route("/v2/com", func(r chi.Router) {
// r.Get("/", handleV1ComList)
// r.Get("/{cmd}", handleV1)
// })
r.NotFound(notFound)
log.Info("Server started", slog.String("address", cfg.Address))
http.ListenAndServe(cfg.Address, r)