Skip to content

Instantly share code, notes, and snippets.

@IvanShamatov
Created January 12, 2016 19:38
Show Gist options
  • Save IvanShamatov/559771d64b9da8135375 to your computer and use it in GitHub Desktop.
Save IvanShamatov/559771d64b9da8135375 to your computer and use it in GitHub Desktop.
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