A simple Todo list written api
performing crud operations using React as Frontend.
I also used ant.design for style components.
Cross-Origin Resource Sharing (CORS) is an HTTP-header based mechanism that allows a server to indicate any origins (domain, scheme, or port) other than its own from which a browser should permit loading resources. By default it's not handled by the framework which will not allow our frontend to make request to the api.
Some changes needs to be done at the back-end side(api):
- Add
gem "rack-cors", "~> 1.1"
to your GemFile - In your cors.rb file do the following:
allow do
origins 'https://your-url.com'
resource '*',
headers: :any,
methods: [:get, :post, :put, :patch, :delete, :options, :head]
end
end
- Enable
config.force_ssl = true
from yourproduction.rb
file