<commit_before>package router

import (
	"github.com/gorilla/mux"
	"net/http"
)

// Route type is used to specify a specific endpoint.
type Route struct {
	Name       string
	Method     []string
	Pattern    string
	Handler    http.HandlerFunc
	Middleware []Middleware
}

type Middleware func(http.HandlerFunc) http.HandlerFunc

// Routes is used to bundle Route's
type Routes []Route

// Resource is the "parent" of routes, meaning that the pattern of the Routes will always be prefixed by the Path of the preceding resources.
type Resource struct {
	Path       string
	Resources  Resources
	Routes     Routes
	Middleware []Middleware
}

func (r Resource) resources() Resources {
	if r.Middleware == nil {
		return r.Resources
	}

	for i := range r.Resources {
		r.Resources[i].Middleware = append(r.Middleware, r.Resources[i].Middleware...)
	}

	return r.Resources<commit_msg>Added comment<commit_after>package router

import (
	"github.com/gorilla/mux"
	"net/http"
)

// Route type is used to specify a specific endpoint.
type Route struct {
	Name       string
	Method     []string
	Pattern    string
	Handler    http.HandlerFunc
	Middleware []Middleware
}

// Middleware is a faux class for functions that wrap the handler
type Middleware func(http.HandlerFunc) http.HandlerFunc

// Routes is used to bundle Route's
type Routes []Route

// Resource is the "parent" of routes, meaning that the pattern of the Routes will always be prefixed by the Path of the preceding resources.
type Resource struct {
	Path       string
	Resources  Resources
	Routes     Routes
	Middleware []Middleware
}

func (r Resource) resources() Resources {
	if r.Middleware == nil {
		return r.Resources
	}

	for i := range r.Resources {
		r.Resources[i].Middleware = append(r.Middleware, r.Resources[i].Middleware...)
	}

	return r.Resources
{'fraction_non_alphanumeric': 0.08351648351648351, 'fraction_numerical': 0.0, 'mean_word_length': 3.5525, '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': '3970655', 'n_tokens_mistral': 531, 'n_tokens_neox': 534, 'n_words': 199}