feat: registered file based routing

This commit is contained in:
grngxd 2025-05-05 14:06:15 +01:00
parent 69e3133563
commit f2e666874d
2 changed files with 17 additions and 18 deletions

View file

@ -1,26 +1,12 @@
package api
import (
"net/http"
"github.com/gin-gonic/gin"
"stereo.cat/backend/internal/api/routes"
"stereo.cat/backend/internal/types"
)
func Register(cfg *types.StereoConfig) []types.Route {
routes := []types.Route{
{
Path: "/ping",
Method: http.MethodGet,
Exec: func(cfg *types.StereoConfig) gin.HandlerFunc {
return func(c *gin.Context) {
c.String(http.StatusOK, "Pong!")
}
},
},
}
func Register(cfg *types.StereoConfig) {
api := cfg.Router.Group("/api")
types.RegisterRoutes("/api", routes, cfg)
return routes
routes.RegisterPingRoutes(api)
}