invidious-mod-JP/src/invidious/routing.cr
saltycrys b45f371911 Make config a constant
Instead of passing around `config` there is now the global `CONFIG`.
2021-01-23 19:39:04 +01:00

16 lines
405 B
Crystal

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