2020-10-05 23:41:18 -05:00
|
|
|
module Invidious::Routing
|
2020-11-19 19:21:48 -06:00
|
|
|
macro get(path, controller, method = :handle)
|
2020-10-05 23:41:18 -05:00
|
|
|
get {{ path }} do |env|
|
2020-11-02 18:06:06 -06:00
|
|
|
controller_instance = {{ controller }}.new(config, logger)
|
2020-11-19 19:21:48 -06:00
|
|
|
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)
|
2020-10-05 23:41:18 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|