INNER CODE UNIT · Go

handleTemplates

machinebox/remoto · console/api/main.go:30

func handleTemplates() http.HandlerFunc {
	var init sync.Once
	var err error
	type template struct {
		Name         string   `json:"name"`
		Experimental bool     `json:"x"`
		Dirs         []string `json:"dirs"`
		Label        string   `json:"label"`
	}
	var response struct {
		Templates []template `json:"templates"`
	}
	return func(w http.ResponseWriter, r *http.Request) {
		init.Do(func() {
			err = filepath.Walk("templates", func(path string, info os.FileInfo, err error) error {
				if err != nil {
					return err
				}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…