feat: handler base + starting types

This commit is contained in:
hexlocation 2025-05-04 21:26:51 +02:00
commit 7a5d8edfc6
5 changed files with 195 additions and 0 deletions

26
src/internal/api/api.go Normal file
View file

@ -0,0 +1,26 @@
package api
import (
"net/http"
"github.com/gin-gonic/gin"
"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!")
}
},
},
}
types.RegisterRoutes("/api", routes, cfg)
return routes
}