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|
|
2021-01-23 18:39:04 +00:00
|
|
|
controller_instance = {{ controller }}.new
|
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|
|
2021-01-23 18:39:04 +00:00
|
|
|
controller_instance = {{ controller }}.new
|
2020-11-20 01:21:48 +00:00
|
|
|
controller_instance.{{ method.id }}(env)
|
2020-10-06 04:41:18 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|