<commit_before>package gene

import "bytes"

func (m *Module) GenerateHandlers() error {
	temp := templates.New("handlers.tmpl")
	_, err := temp.Parse(HandlerTemplate)
	if err != nil {
		return err
	}

	var buf bytes.Buffer

	err = templates.ExecuteTemplate(&buf, "handlers.tmpl", m.schema)
	if err != nil {
		return err
	}

	path := "./gene/modules/" + lowFirst(m.schema.Title) + "/" + lowFirst(m.schema.Title) + "api/" + lowFirst(m.schema.Title) + ".go"

	return writeFormattedFile(path, buf.Bytes())
}

var HandlerTemplate = `package {{lowFirst .Title}}api
func InitHandlers(mux *tigertonic.TrieServeMux) *tigertonic.TrieServeMux {
    // Updates {{lowFirst .Title}} by it's ID
    mux.Handle("POST", "/{{lowFirst .Title}}/{id}", handler.Wrapper(<commit_msg>Handler Generator: updated handler generator with a context<commit_after>package gene

import "bytes"

func (m *Module) GenerateHandlers() error {
	temp := templates.New("handlers.tmpl")
	_, err := temp.Parse(HandlerTemplate)
	if err != nil {
		return err
	}

	var buf bytes.Buffer

	err = templates.ExecuteTemplate(&buf, "handlers.tmpl", m.schema)
	if err != nil {
		return err
	}

	path := "./gene/modules/" + lowFirst(m.schema.Title) + "/api/" + lowFirst(m.schema.Title) + ".go"

	return writeFormattedFile(path, buf.Bytes())
}

var HandlerTemplate = `package {{lowFirst .Title}}api

// New creates a new local api handler
func New() gene.Initer { return &api{} }

// api is for holding the interface functions, nothing more
type api struct{}

func (api) Init(mux *tigertonic.TrieServeMux) *tigertonic.TrieServeMux {

    // Updates {{lowFirst .Title}} by it's ID
    mux.Handle("POST", "/{{lowFirst .Title}}/{id}", handler.Wrapper(
{'fraction_non_alphanumeric': 0.15683962264150944, 'fraction_numerical': 0.0, 'mean_word_length': 4.237654320987654, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5590015', 'n_tokens_mistral': 590, 'n_tokens_neox': 563, 'n_words': 148}