/rails-react

Primary LanguageRubyMIT LicenseMIT

Hello world

Description

In this exercise I've used the react-rails gem. This gem allows you to build React components as a part of your Rails JavaScript and serve it in a component, react_component, to be used in a regular ERB file.

Learning objectives

  • Implement a connection between a Ruby on Rails back-end and React front-end.
  • Understand the pros and cons of different approaches of connecting Ruby on Rails back-end with React front-end.

Getting Started

To get a local copy for this project and running follow these simple example steps.

Prerequisites

  • You need to have git installed in your machine.
  • Install a recent version of Postgres.
  • Already install Rails
  • Already insatll React

Setup

Creating the rails-react

Clone this repository

$ https://github.com/Alexr16/rails-react.git
$ cd rails-react

Create the database

$   rails db:create 
$   rails db:migrate

Run

$   bundle install
$   yarn install
$   npm install

Starting up the Web Server

  • You can now run:
$   rails s # or
$   rails server -p3000 # to visit http://localhost/
  • To see React-Router working:
$  ./bin/webpack-dev-server # enables auto-webpacking

Listing Existing Routes

  • You can now visit http://localhost:3000 to view your new website!

Author

👤 Jorge Rios

🤝 Contributing

Contributions, issues, and feature requests are welcome!

Feel free to check the issues page.

Show your support

Give a ⭐️ if you like this project!

Acknowledgments

  • Thanks to my peers who are always there to offer support.

📝 License

This project is MIT licensed.