invidious-mod-JP/src/invidious/routing.cr
2020-11-19 19:21:48 -06:00

16 lines
437 B
Crystal

module Invidious::Routing
macro get(path, controller, method = :handle)
get {{ path }} do |env|
controller_instance = {{ controller }}.new(config, logger)
controller_instance.{{ method.id }}(env)
end
end
macro post(path, controller, method = :handle)
post {{ path }} do |env|
controller_instance = {{ controller }}.new(config, logger)
controller_instance.{{ method.id }}(env)
end
end
end