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