Created
January 12, 2016 19:38
-
-
Save IvanShamatov/559771d64b9da8135375 to your computer and use it in GitHub Desktop.
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 'json' | |
module MyApp | |
class API < Sinatra::Base | |
content_type :json | |
Report.all.to_json | |
end | |
class Admin < Sinatra::Base | |
use SinatraAdmin::App | |
SinatraAdmin.register 'Report' | |
end | |
end | |
# rackup file | |
require 'myapp.rb' | |
map "/api" | |
run MyApp::API | |
end | |
map "/admin" do #mounted over "/admin" namespace(mandatory) | |
run MyApp::Admin | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment