Merge branch 'dev' of ssh://git.iwakura.rip:6969/stereo.cat/backend into dev
This commit is contained in:
commit
eb8d1a271c
2 changed files with 17 additions and 18 deletions
|
@ -1,26 +1,12 @@
|
||||||
package api
|
package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"stereo.cat/backend/internal/api/routes"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
|
||||||
"stereo.cat/backend/internal/types"
|
"stereo.cat/backend/internal/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Register(cfg *types.StereoConfig) []types.Route {
|
func Register(cfg *types.StereoConfig) {
|
||||||
routes := []types.Route{
|
api := cfg.Router.Group("/api")
|
||||||
{
|
|
||||||
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)
|
routes.RegisterPingRoutes(api)
|
||||||
|
|
||||||
return routes
|
|
||||||
}
|
}
|
||||||
|
|
13
internal/api/routes/ping.go
Normal file
13
internal/api/routes/ping.go
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
package routes
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
)
|
||||||
|
|
||||||
|
func RegisterPingRoutes(api *gin.RouterGroup) {
|
||||||
|
api.GET("/ping", func(c *gin.Context) {
|
||||||
|
c.String(http.StatusOK, "Pong!")
|
||||||
|
})
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue