lib/qpush/web/server.rb in qpush-0.1.4 vs lib/qpush/web/server.rb in qpush-0.1.6
- old
+ new
@@ -1,20 +1,20 @@
module QPush
module Web
class Server < Sinatra::Base
- set :public_folder, Gem::Specification.find_by_name('qpush').gem_dir + '/lib/qpush/web/public'
+ #set :public_folder, File.expand_path(File.dirname(__FILE__)) + '/public'
before do
- pass if request.path_info == '/'
+ #pass if request.path_info == '/'
content_type :json
headers 'Access-Control-Allow-Origin' => '*',
'Access-Control-Allow-Methods' => ['OPTIONS', 'GET', 'POST']
end
- get '/' do
- File.read(File.join(settings.public_folder, 'index.html'))
- end
+ #get '/' do
+ #File.read(File.join(settings.public_folder, 'index.html'))
+ #end
get '/stats' do
Get.stats
end
@@ -46,9 +46,13 @@
Get.retries(params[:start], params[:count])
end
get '/morgue' do
Get.morgue(params[:start].to_i, params[:count].to_i)
+ end
+
+ post '/create' do
+ Post.create(params)
end
end
end
end