Skip to content
Browse files

Add ability to export contacts in JSON

  • Loading branch information...
1 parent af6a570 commit 0c27ae1102a964d66f0984e2fd3e1824b980a0b0 @leereilly leereilly committed Apr 25, 2012
Showing with 9 additions and 1 deletion.
  1. +9 −1 landingpad.rb
View
10 landingpad.rb
@@ -17,7 +17,7 @@ class LandingPad < Sinatra::Base
# Page settings - used to configure your landing page
$page_title = 'LandingPad.rb | Just add water landing pages'
$app_title = 'LandingPad.rb'
- $app_summary = 'Get a page up and running in minutes and
+ $app_summary = 'Get a page up and running in minutes and
start collecting contacts immediately!'
#your google analyics tracking key, if applicable
$google_analytics_key = 'UA-XXXXXX-X'
@@ -58,6 +58,14 @@ def authorized?
erb :contacts
end
+ get '/contacts.json' do
+ protected!
+ content_type :json
+ @contacts = $collection.find()
+ @results = @contacts.to_a();
+ JSON.dump(@results)
+ end
+
post '/subscribe' do
content_type :json
contact = params[:contact]

0 comments on commit 0c27ae1

Please sign in to comment.
Something went wrong with that request. Please try again.