| Module | Grape::DSL::Routing::ClassMethods |
| In: |
lib/grape/dsl/routing.rb
|
| endpoints | [R] |
Declare a "namespace", which prefixes all subordinate routes with its name. Any endpoints within a namespace, or group, resource, segment, etc., will share their parent context as well as any configuration done in the namespace context.
@example
namespace :foo do
get 'bar' do
# defines the endpoint: GET /foo/bar
end
end
Defines a route that will be recognized by the Grape API.
@param methods [HTTP Verb] One or more HTTP verbs that are accepted by this route. Set to `:any` if you want any verb to be accepted. @param paths [String] One or more strings representing the URL segment(s) for this route.
@example Defining a basic route.
class MyAPI < Grape::API
route(:any, '/hello') do
{hello: 'world'}
end
end