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

Commit

Permalink
Add ability to export contacts in JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
leereilly committed Apr 26, 2012
1 parent af6a570 commit 0c27ae1
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_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'
Expand Down Expand Up @@ -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]
Expand Down

0 comments on commit 0c27ae1

Please sign in to comment.