Creating RESTful API using Grape and RABL in Rails 4
We can create a RESTful API using Grape and RABL in Rails4. Step 1: Add this GEMS in your Gem file, And do Bundle install. gem 'grape' gem 'rabl-rails' gem 'grape-rabl' gem 'rack-cors', :require => 'rack/cors' Step 2: Create a file under lib directory called api.rb, and create a folder inside the view named as api. # lib/api/v1/root.rb class API < Grape::API end Step 3: Add this line to your application.rb file config.paths.add "app/api", glob: "**/*.rb" config.autoload_paths += %W(#{config.root}/lib #{config.root}/app/api/*) config.middleware.use Rack::Cors do allow do origins '*' # location of your API resource '/*', :headers => :any, :methods => [:get, :post, :options, :put, :delete] end end config.middleware.use(Rack::Config...