-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.rb
More file actions
33 lines (25 loc) · 944 Bytes
/
app.rb
File metadata and controls
33 lines (25 loc) · 944 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
class SampleApp < Sinatra::Base
helpers Sinatra::JSON
register Sinatra::Partial
register Sinatra::SessionAuth
register Sinatra::ActiveRecordExtension
set :environments, %w{development staging production}
set :root, File.dirname(__FILE__)
set :views, Proc.new { File.join(root, "app/views") }
set :public_folder, Proc.new { File.join(root, "public") }
set :session_secret, "sample_app_secret_token"
set :partial_template_engine, :erb
enable :logging, :sessions, :partial_underscores
configure :development do
enable :dump_errors, :raise_errors
use ::BetterErrors::Middleware
end
configure :staging, :production do
set :raise_errors, true
set :show_exceptions, false
set :dump_errors, false
file = File.new("#{settings.root}/log/#{settings.environment}.log", 'a+')
file.sync = true
use Rack::CommonLogger, file
end
end