Add sane sinatra defaults for the web services

This commit is contained in:
Nick Thomas
2011-05-15 01:38:34 +01:00
parent 8b5a14953f
commit 103dcea1c1
3 changed files with 18 additions and 3 deletions

View File

@@ -7,6 +7,11 @@ module SharpCoin
# #
# @author Nick Thomas <nick@lupine.me.uk> # @author Nick Thomas <nick@lupine.me.uk>
class JsonRpc < Sinatra::Base class JsonRpc < Sinatra::Base
set :environment, :production
disable :sessions, :logging, :run, :dump_errors, :raise_errors, :lock
enable :method_override, :static, :show_exceptions
set :root, File.join(File.dirname(__FILE__), 'web')
end end
JsonRPC = JsonRpc JsonRPC = JsonRpc
JSONRPC = JsonRpc JSONRPC = JsonRpc

View File

@@ -7,6 +7,11 @@ module SharpCoin
# #
# @author Nick Thomas <nick@lupine.me.uk> # @author Nick Thomas <nick@lupine.me.uk>
class Rest < Sinatra::Base class Rest < Sinatra::Base
set :environment, :production
disable :sessions, :logging, :run, :dump_errors, :raise_errors, :lock
enable :method_override, :static, :show_exceptions
set :root, File.join(File.dirname(__FILE__), 'web')
end end
REST = Rest REST = Rest
end end

View File

@@ -1,4 +1,5 @@
require 'sinatra/base' require 'sinatra/base'
require 'sharp-coin/interface/json-rpc'
require 'sharp-coin/interface/rest' require 'sharp-coin/interface/rest'
module SharpCoin module SharpCoin
@@ -12,13 +13,17 @@ module SharpCoin
# #
# @author Nick Thomas <nick@lupine.me.uk> # @author Nick Thomas <nick@lupine.me.uk>
class WebReal < Sinatra::Base class WebReal < Sinatra::Base
set :environment, :production
end disable :sessions, :logging, :run, :dump_errors, :raise_errors, :lock
enable :method_override, :static, :show_exceptions
set :root, File.join(File.dirname(__FILE__), 'web')
end
Web = Rack::Builder.new do Web = Rack::Builder.new do
map("/api/rpc/") { run JsonRPC } map("/api/rpc/") { run JsonRPC }
map("/api/rest/") { run REST } map("/api/rest/") { run REST }
map("/") { run WebReal } map("/") { run WebReal }
end end
end end