Skip to content

Latest commit

 

History

History
34 lines (26 loc) · 1.84 KB

README.md

File metadata and controls

34 lines (26 loc) · 1.84 KB

A Todo list App with React Frontend With Rails Api

A simple Todo list written api performing crud operations using React as Frontend. I also used ant.design for style components.

Key Challenges

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 your production.rb file

🔗 Demo

Tech Stack

React Ruby Rails Postgres Heroku Sublime Text Linux