module Pakyow::Routing::Extension::Resource

An extension for defining RESTful Resources. For example:

resource :posts, "/posts" do
  list do
    # list the posts
  end
end

Resource is available in all controllers by default.

Supported Actions

These actions are supported:

Nested Resources

Resources can be nested. For example:

resource :posts, "/posts" do
  resource :comments, "/comments" do
    list do
      # available at GET /posts/:post_id/comments
    end
  end
end

Collection Routes

Routes can be defined for the collection. For example:

resource :posts, "/posts" do
  collection do
    get "/foo" do
      # available at GET /posts/foo
    end
  end
end

Member Routes

Routes can be defined as members. For example:

resource :posts, "/posts" do
  member do
    get "/foo" do
      # available at GET /posts/:post_id/foo
    end
  end
end

Constants

DEFAULT_PARAM