Created
May 15, 2015 19:51
-
-
Save dblock/b173bb4ceb9fe2ebed97 to your computer and use it in GitHub Desktop.
Grape on Goliath
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'https://rubygems.org' | |
gem 'grape' | |
gem 'goliath' | |
gem 'json' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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