Method: Grape::DSL::Routing::ClassMethods#route
- Defined in:
- lib/grape/dsl/routing.rb
#route(methods, paths = ['/'], route_options = {}, &block) ⇒ Object
Defines a route that will be recognized by the Grape API.
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
# File 'lib/grape/dsl/routing.rb', line 127 def route(methods, paths = ['/'], = {}, &block) methods = '*' if methods == :any = { method: methods, path: paths, for: self, route_options: { params: namespace_stackable_with_hash(:params) || {} }.deep_merge(route_setting(:description) || {}).deep_merge( || {}) } new_endpoint = Grape::Endpoint.new(inheritable_setting, , &block) endpoints << new_endpoint unless endpoints.any? { |e| e.equals?(new_endpoint) } route_end reset_validations! end |