Skip to content

Commit

Permalink
Add header controls to API
Browse files Browse the repository at this point in the history
  • Loading branch information
LFDM committed Aug 12, 2014
1 parent 5d3e8a6 commit 56bd769
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/llt/form_builder/api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
class Api < Sinatra::Base
register Sinatra::RespondWith

before do
headers 'Access-Control-Allow-Origin' => '*',
'Access-Control-Allow-Methods' => %w{ GET POST },
'Access-Control-Allow-Headers' => %w{ Content-Type }
end

post '/generate' do
request_json = JSON.parse(request.body.read)
forms = LLT::FormBuilder.build(*request_json)
Expand Down

0 comments on commit 56bd769

Please sign in to comment.