- Go backend: Echo v4 + pgxpool + embedded golang-migrate; health endpoints at /health and /api/v1/health; TDD health handler (httptest) - Vue 3 frontend: Vite + TypeScript + Pinia + vue-router + Tailwind CSS v4; TDD HelloWorld component (@vue/test-utils + jsdom + vitest) - Infra: docker-compose postgres:16 with env-interpolated credentials; Makefile with dev-db health-wait loop, migrate-up/down, run, test, fmt - embed.FS migrations at backend/migrations/ (000001 no-op baseline) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
34 lines
777 B
Go
34 lines
777 B
Go
package main
|
|
|
|
import (
|
|
"github.com/jackc/pgx/v5/pgxpool"
|
|
"github.com/labstack/echo/v4"
|
|
"github.com/labstack/echo/v4/middleware"
|
|
|
|
"osdb/internal/handler"
|
|
)
|
|
|
|
// New creates and configures the Echo instance with all routes registered.
|
|
// Extension point: story #2, #4, #7, #8 route groups are added here.
|
|
func New(pool *pgxpool.Pool) *echo.Echo {
|
|
e := echo.New()
|
|
e.HideBanner = true
|
|
|
|
// Global middleware
|
|
e.Use(middleware.Logger())
|
|
e.Use(middleware.Recover())
|
|
|
|
health := handler.NewHealthHandler()
|
|
|
|
// Root health — used by docker healthcheck + ops tooling
|
|
e.GET("/health", health.Health)
|
|
|
|
// Versioned API group
|
|
api := e.Group("/api/v1")
|
|
api.GET("/health", health.Health)
|
|
|
|
// Future story groups (fruits, publications, admin, auth) are added here.
|
|
|
|
return e
|
|
}
|