Skip to content

Instantly share code, notes, and snippets.

@brennovich
Forked from teamon/Gemfile
Last active August 29, 2015 14:26
Show Gist options
  • Save brennovich/b98205fce18da3e104dd to your computer and use it in GitHub Desktop.
Save brennovich/b98205fce18da3e104dd to your computer and use it in GitHub Desktop.
Mount Grape API at rails root
# Thanks to http://thesmallestrailsapp.com/
Bundler.require
# Your grape API
class API < Grape::API
get { "Hello from Grape" }
get "/moar" do
"Moar"
end
end
run TheSmallestRailsApp ||= Class.new(Rails::Application) {
config.secret_key_base = routes.append {
mount API => "/" # This will handle "/moar" and others
root to: API # This will handle the root path "/"
}.to_s
initialize!
}
source "http://rubygems.org"
gem "railties", '4.0.3', require: %w(action_controller rails)
gem "grape"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment