예제 #1
0
// get list of available front components
func getComponentsHandler(c *echo.Context) error {
	fis, err := ioutil.ReadDir(filepath.Join(env("FRONT_DIR", "front/"), "ts/components"))
	if err != nil {
		module.Log.Fatal("Unable to load the components folder. ", err)
		return c.Err()
	}
	var comps []string
	for _, f := range fis {
		comps = append(comps, f.Name())
	}
	return c.JSON(http.StatusOK, comps)
}