Skip to content
This repository has been archived by the owner on Oct 18, 2019. It is now read-only.

Commit

Permalink
Merge pull request #2 from leereilly/json-export
Browse files Browse the repository at this point in the history
Add ability to export contacts in JSON
  • Loading branch information
matt swanson committed Apr 26, 2012
2 parents af6a570 + 0c27ae1 commit 0cbf161
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion landingpad.rb
Expand Up @@ -17,7 +17,7 @@ class LandingPad < Sinatra::Base
# Page settings - used to configure your landing page # Page settings - used to configure your landing page
$page_title = 'LandingPad.rb | Just add water landing pages' $page_title = 'LandingPad.rb | Just add water landing pages'
$app_title = 'LandingPad.rb' $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!' start collecting contacts immediately!'
#your google analyics tracking key, if applicable #your google analyics tracking key, if applicable
$google_analytics_key = 'UA-XXXXXX-X' $google_analytics_key = 'UA-XXXXXX-X'
Expand Down Expand Up @@ -58,6 +58,14 @@ def authorized?
erb :contacts erb :contacts
end end


get '/contacts.json' do
protected!
content_type :json
@contacts = $collection.find()
@results = @contacts.to_a();
JSON.dump(@results)
end

post '/subscribe' do post '/subscribe' do
content_type :json content_type :json
contact = params[:contact] contact = params[:contact]
Expand Down

0 comments on commit 0cbf161

Please sign in to comment.