Permalink
Browse files

A basic Grape API mounted on RACK.

  • Loading branch information...
0 parents commit f998058cc34c03ad8b035a64799b44359937f538 @dblock dblock committed Jan 30, 2012
Showing with 103 additions and 0 deletions.
  1. +6 −0 Gemfile
  2. +36 −0 Gemfile.lock
  3. +5 −0 README.md
  4. +19 −0 api/api.rb
  5. +8 −0 config.ru
  6. +6 −0 config/application.rb
  7. +3 −0 config/boot.rb
  8. +4 −0 config/environment.rb
  9. +1 −0 public/images/index.html
  10. BIN public/images/rack-logo.png
  11. +15 −0 public/index.html
@@ -0,0 +1,6 @@
+source "http://rubygems.org"
+
+gem "rack", "1.3.5"
+gem "rack-contrib", :git => "https://github.com/rack/rack-contrib.git", :require => "rack/contrib"
+gem "grape", :git => "http://github.com/intridea/grape.git", :branch => "frontier"
+
@@ -0,0 +1,36 @@
+GIT
+ remote: http://github.com/intridea/grape.git
+ revision: 6d8793f0f6cb3146f7b4c5d56fccbdfbe3ac9875
+ branch: frontier
+ specs:
+ grape (0.1.5)
+ hashie (~> 1.2)
+ multi_json
+ multi_xml
+ rack
+ rack-mount
+
+GIT
+ remote: https://github.com/rack/rack-contrib.git
+ revision: af3663ca6200f8292b221acd5a406af33c219249
+ specs:
+ rack-contrib (1.1.0)
+ rack (>= 0.9.1)
+
+GEM
+ remote: http://rubygems.org/
+ specs:
+ hashie (1.2.0)
+ multi_json (1.0.4)
+ multi_xml (0.4.1)
+ rack (1.3.5)
+ rack-mount (0.8.3)
+ rack (>= 1.0.0)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ grape!
+ rack (= 1.3.5)
+ rack-contrib!
@@ -0,0 +1,5 @@
+Grape API on Rack
+=================
+
+A [Grape](http://github.com/intridea/grape) API mounted on RACK.
+
@@ -0,0 +1,19 @@
+
+module Acme
+
+ class API < Grape::API
+
+ version 'v1', :using => :header, :vendor => 'acme', :format => :json
+
+ resource :system do
+
+ desc "Returns pong."
+ get :ping do
+ "pong"
+ end
+
+ end
+
+ end
+end
+
@@ -0,0 +1,8 @@
+require File.expand_path('../config/environment', __FILE__)
+
+use Rack::TryStatic,
+ :root => File.expand_path('../public', __FILE__),
+ :urls => %w[/], :try => ['.html', 'index.html', '/index.html']
+
+run Acme::API
+
@@ -0,0 +1,6 @@
+require File.expand_path('../boot', __FILE__)
+
+Bundler.require :default, ENV['RACK_ENV']
+
+require File.expand_path('../../api/api', __FILE__)
+
@@ -0,0 +1,3 @@
+require 'rubygems'
+require 'bundler/setup'
+
@@ -0,0 +1,4 @@
+ENV['RACK_ENV'] ||= :test
+
+require File.expand_path('../application', __FILE__)
+
@@ -0,0 +1 @@
+This folder contains images.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,15 @@
+<html>
+ <head>
+ <title>Rack Powers Web APIs</title>
+ </head>
+ <body>
+ <h1>Rack Powers Web APIs</h1>
+ <a href="http://rack.rubyforge.org/">
+ <img src="images/rack-logo.png">
+ </a>
+ <ul>
+ <li><a href="/system/ping">Ping!</a></li>
+ </ul>
+ </body>
+</html>
+

0 comments on commit f998058

Please sign in to comment.