Skip to content

Azhar2k16/Todos-api

Repository files navigation

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published