Rails 5 API and CORS
So if you have your frontend and backend on different domains you'll need to allow CORS (cross-origin HTTP request).
Rails 5 with
--api mode will prepare the setup for you. You just need to uncomment the following:
# Gemfile gem 'rack-cors'
# config/initializers/cors.rb Rails.application.config.middleware.insert_before 0, Rack::Cors do allow do origins 'localhost:4200' resource '*', headers: :any, methods: %i(get post put patch delete options head) end end