27 lines
656 B
Go
27 lines
656 B
Go
package apihandler
|
|
|
|
import (
|
|
"net/http"
|
|
"sort"
|
|
|
|
"codeberg.org/vlbeaudoin/pave"
|
|
"git.agecem.com/agecem/agecem-org/config"
|
|
"git.agecem.com/agecem/agecem-org/media"
|
|
"github.com/labstack/echo/v4"
|
|
)
|
|
|
|
type V1Handler struct {
|
|
Config config.Config
|
|
MediaClient *media.MediaClient
|
|
Pave *pave.Pave
|
|
}
|
|
|
|
// API Handlers
|
|
|
|
// V1GET affiche les routes accessibles.
|
|
// Les routes sont triées selon .Path, pour les rendre plus facilement navigables.
|
|
func (h *V1Handler) V1GET(c echo.Context) error {
|
|
routes := c.Echo().Routes()
|
|
sort.Slice(routes, func(i, j int) bool { return routes[i].Path < routes[j].Path })
|
|
return c.JSON(http.StatusOK, routes)
|
|
}
|