Prepare for API v1 (PR #570)

This commit is contained in:
wvengen 2018-10-13 20:16:35 +02:00 committed by GitHub
parent d9ae0d11b0
commit fd96b6ccc1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 536 additions and 217 deletions

View file

@ -48,7 +48,7 @@ module Foodsoft
# parameters by using an attr_accessible or attr_protected declaration.
# TODO Re-activate this. Uncommenting this line will currently cause rspec to fail.
config.active_record.whitelist_attributes = false
# Enable the asset pipeline
config.assets.enabled = true
@ -62,6 +62,14 @@ module Foodsoft
# Load legacy scripts from vendor
config.assets.precompile += [ 'vendor/assets/javascripts/*.js' ]
# CORS for API
config.middleware.insert_before 0, 'Rack::Cors' do
allow do
origins '*'
# this restricts Foodsoft scopes to certain characters - let's discuss it when it becomes an actual problem
resource %r{\A/[-a-zA-Z0-9_]+/api/v1/}, headers: :any, methods: :any
end
end
end
# Foodsoft version