Sha256: 4ef7ffe032554a55c5452330622a65f3384e608d2b172f68514c0f6ccc7cd5ee
Contents?: true
Size: 933 Bytes
Versions: 2
Compression:
Stored size: 933 Bytes
Contents
require 'sinatra/base' require 'sinatra/json' require 'sinatra/reloader' require 'haml' module TogoStanza class Application < Sinatra::Base set :root, File.expand_path('../../..', __FILE__) set :haml, escape_html: true set :protection, except: [:json_csrf, :frame_options] configure :development do register Sinatra::Reloader end helpers do def path(*paths) prefix = env['SCRIPT_NAME'] [prefix, *paths].join('/').squeeze('/') end end get '/' do haml :index end get '/:id' do |id| Stanza.find(id).new(params).render end get '/:id/resources/:resource_id' do |id, resource_id| value = Stanza.find(id).new(params).resource(resource_id) json resource_id => value end get '/:id/help' do |id| @stanza = Stanza.find(id).new render :html, @stanza.help, layout_engine: :haml end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
togostanza-0.0.9 | lib/togostanza/application.rb |
togostanza-0.0.8 | lib/togostanza/application.rb |