func (c *Controllers) AddMiddleware(path string, m echo.MiddlewareFunc) {
	c.middlewares = append(c.middlewares, middleware{
		path:       path,
		middleware: m,
	})
}
AddMiddleware adds 'm' to the paths starting with the 'path'.
package controller
import (
	"net/http"
	"runtime/debug"
	"strings"
	apierror "github.com/go-generalize/api_gen/samples/empty_root/server/pkg/apierror"
	props "github.com/go-generalize/api_gen/samples/empty_root/server/props"
	"github.com/labstack/echo/v4"
)
type middleware struct {
	path       string
	middleware echo.MiddlewareFunc
}
type options struct {
	disableErrorHandling bool
}
type Controllers struct {
	middlewares []middleware
	options
}
func NewControllers(
	props *props.ControllerProps, e *echo.Echo,
) *Controllers {
	ctrl := &Controllers{}
	e.Use(func(next echo.HandlerFunc) echo.HandlerFunc {
		return func(c echo.Context) error {
			for _, m := range ctrl.middlewares {
				if strings.HasPrefix(c.Request().URL.Path, m.path) {
					next = m.middleware(next)
				}
			}
			return next(c)
		}
	})
	e.Use(func(next echo.HandlerFunc) echo.HandlerFunc {
		return func(c echo.Context) (err error) {
			defer func() {
				recoverErr := recover()
				if recoverErr == nil {
					return
				}
				debug.PrintStack()
				if httpErr, ok := recoverErr.(*echo.HTTPError); ok {
					err = c.JSON(httpErr.Code, httpErr.Message)
					return
				}
				err = apierror.NewAPIError(http.StatusInternalServerError, "internal server error.")
			}()
			return next(c)
		}
	})
	addRoutes(e, props, &ctrl.options)
	return ctrl
}