package file import ( "github.com/labstack/echo/v4" "gitnet.fr/deblan/budget/config" "gitnet.fr/deblan/budget/database/model" f "gitnet.fr/deblan/budget/file" ) type Controller struct { } func New(e *echo.Echo) *Controller { c := Controller{} e.GET("/api/files", c.Files) return &c } func (ctrl *Controller) Files(c echo.Context) error { if nil == model.LoadSessionUser(c) { return c.Redirect(302, "/login") } tree := f.GetTree("", config.Get().File.Path) return c.JSON(200, tree) }