Sha256: 66465b061284abeae3a730deb420c9e02ec76635c51ba3acdd24a7834431a1e0

Contents?: true

Size: 397 Bytes

Versions: 1

Compression:

Stored size: 397 Bytes

Contents

module <%= module_name %>
  class <%= pluralize camelize(name) %>Controller < Sinatra::Base

    get '/<%= pluralize name %>/:id' do
      <%= name %> = <%= camelize name %>.find params[:id]
      json <%= name %>.to_hash(:get)
    end

    get '/<%= pluralize name %>' do
      <%= pluralize name %> = <%= camelize name %>.all
      json <%= pluralize name %>.to_hashes(:list)
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
apimaster-0.0.3 lib/apimaster/generators/templates/app/controllers/examples_controller.rb.erb