|
|
|
@ -4,7 +4,11 @@ module Invidious::Routing
|
|
|
|
|
{% for http_method in {"get", "post", "delete", "options", "patch", "put"} %}
|
|
|
|
|
|
|
|
|
|
macro {{http_method.id}}(path, controller, method = :handle)
|
|
|
|
|
{{http_method.id}} \{{ path }} do |env|
|
|
|
|
|
unless !Kemal::Utils.path_starts_with_slash?(\{{path}})
|
|
|
|
|
raise Kemal::Exceptions::InvalidPathStartException.new({{http_method}}, \{{path}})
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
Kemal::RouteHandler::INSTANCE.add_route({{http_method.upcase}}, \{{path}}) do |env|
|
|
|
|
|
\{{ controller }}.\{{ method.id }}(env)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|