Skip to content

Instantly share code, notes, and snippets.

@dblock
Created May 15, 2015 19:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dblock/b173bb4ceb9fe2ebed97 to your computer and use it in GitHub Desktop.
Save dblock/b173bb4ceb9fe2ebed97 to your computer and use it in GitHub Desktop.
Grape on Goliath
require 'rubygems'
require 'bundler'
Bundler.require
require 'grape'
require 'json'
require 'goliath'
module MyApp
class API < Grape::API
format :json
prefix 'api'
version 'v1'
resource :messages do
post do
{}
end
get do
{}
end
end
end
class App < Goliath::API
use Goliath::Rack::Params
use Goliath::Rack::Render
def response(env)
MyApp::API.call(env)
end
end
end
source 'https://rubygems.org'
gem 'grape'
gem 'goliath'
gem 'json'
run with `ruby app.rb`, then go to http://localhost:9000/api/v1/messages
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment