An open API service indexing awesome lists of open source software.

https://github.com/luigirazum/hello-rails-back-end

"Hello World" sample project with two apps. This is the API made in Rails.
https://github.com/luigirazum/hello-rails-back-end

Last synced: 7 months ago
JSON representation

"Hello World" sample project with two apps. This is the API made in Rails.

Awesome Lists containing this project

README

          

wave

### About
**Hello Rails React** is a sample project that shows how to integrate Rails and React. [See more...](#about-project)


# πŸ“— Table of Contents

- [πŸ’¬ About the project](#about-project)
- [πŸ›  Built With](#built-with)
- [Tech Stack](#tech-stack)
- [Key Features](#key-features)
- [πŸš€ Live Demo](#live-demo)
- [πŸ’» Getting Started](#getting-started)
- [Prerequisites](#prerequisites)
- [Setup](#setup)
- [Usage](#usage)
- [Run](#run)
- [Open](#open)
- [πŸ‘₯ Author](#author)
- [πŸ”­ Future Features](#future-features)
- [🀝 Contributing](#contributing)
- [⭐️ Show your support](#support)
- [πŸ™ Acknowledgements](#acknowledgements)
- [πŸ“ License](#license)


# πŸ‘‹**Hello Rails React**

**Hello Rails React** is a sample project that shows how to integrate Rails and React.
It is composed of two projects, one for the back end and another one for the front end.

### Ruby on Rails
- RoR is used for the back end, and it is configured as an api, so it attends the requests of the front end.
- [`hello-rails-back-end`](https://github.com/luigirazum/hello-rails-back-end) this repository, is the one that holds the RoR project.

### React
- React is used for the front end, and it consumes the back end as an API.
- [`hello-react-front-end`](https://github.com/luigirazum/hello-react-front-end), is the repository that holds the React project.

## πŸ›  Built With

- ### Tech Stack

#### Back End with RoR

#### Front End with React/Redux

- ### Key Features

- Uses **Ruby on Rails** for the Back End.
- Back End is an API.
- Back End preserves data in a **Postgress DB**.
- Uses **React** for the Front End.
- Uses React components.
- Uses **Redux** to handle the state of the app.

(back to top)

## πŸ’» Getting Started

To get a local copy of this project up and running, follow these steps.

- ### Prerequisites for the Back End

- `git` installed. Please got to [Getting Started - Installing Git guide](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) and follow the steps described for your system to install `git`.
- `Ruby` installed, you can go to the [Installing Ruby](https://www.ruby-lang.org/en/documentation/installation/) documentation and follow the steps for your computer OS.
- `Rails` installed, you can follow the [GoRails Tutorial](https://gorails.com/setup/) and follow the steps for your computer OS.
- `PostgreSQL` installed, you can follow the [PostgreSQL Tutorial](https://www.postgresqltutorial.com/) and follow the steps for your computer OS.

- ### Setup
Clone this repository to your `local-folder`:
```sh
cd local-folder
git clone git@github.com:luigirazum/hello-rails-back-end.git
```
- ### Usage
In the `local-folder` where you cloned the project, go into the project folder
```sh
cd hello-rails-back-end
```
- ### Prepare
In the `hello-rails-back-end` folder, use the following code to install the app dependencies
```rb
bundle install
```
- ### Run
In the `hello-rails-back-end` folder, use the following code to run the app
```rb
rails server
```
- ### Open
That's it, the API is running now.\
Running the following command in your terminal:
```sh
curl --verbose --get 'http://127.0.0.1:3000/api/v1/greetings/random' --header 'Accept: "application/json"'
```
Will throw something like the following:
```sh
* Trying 127.0.0.1:3000...
* Connected to 127.0.0.1 (127.0.0.1) port 3000 (#0)
> GET /api/v1/greetings/random HTTP/1.1
> Host: 127.0.0.1:3000
> User-Agent: curl/7.81.0
> Accept: "application/json"
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< x-frame-options: SAMEORIGIN
< x-xss-protection: 0
< x-content-type-options: nosniff
< x-permitted-cross-domain-policies: none
< referrer-policy: strict-origin-when-cross-origin
< content-type: application/json; charset=utf-8
< etag: W/"ddb1f6216f69d27ea533d4d810381d26"
< cache-control: max-age=0, private, must-revalidate
< x-request-id: 3f02e9c6-3b14-4498-a7a1-8ab8833a8eb5
< x-runtime: 0.008468
< server-timing: start_processing.action_controller;dur=0.01, sql.active_record;dur=1.06, instantiation.active_record;dur=0.10, process_action.action_controller;dur=5.35
< vary: Origin
< Content-Length: 254
<
* Connection #0 to host 127.0.0.1 left intact
{"data":{"id":6,"message":"Say Hello to Rails with React","created_at":"2024-03-12T09:17:22.649Z","updated_at":"2024-03-12T09:17:22.649Z"},"headers":{"Access-Control-Allow-Origin":"http://localhost:3001","Content-Type":"application/json; charset=utf-8"}}%
```

Go to [`hello-react-front-end`](https://github.com/luigirazum/hello-react-front-end), to get instructions about how to start the Front End.

(back to top)

## πŸ‘₯ Author

πŸ‘¨β€πŸ’» **Luis Zubia**

(back to top)

## πŸ”­ Future Features

- Implement more Entry Points.
- Handle Authentication.

(back to top)

## 🀝 Contributing

Contributions, issues, typos, and feature requests or suggestions are welcome!

Feel free to check the [issues page](../../issues/).

(back to top)

## ⭐️ Show your support

If you like this project, I will really appreciate your support, and don't forget to give a ⭐ to this repository.

(back to top)

## πŸ™ Acknowledgments

- I would like to thank [Yukihiro β€œMatz” Matsumoto](http://www.rubyist.net/~matz/) for creating the [Ruby Programming Language](https://www.ruby-lang.org/en/).
- Thanks [David Heinemeier Hansson](https://en.wikipedia.org/wiki/David_Heinemeier_Hansson) for sharing [Rails](https://rubyonrails.org/) to the world.\
_**Wikipedia:** [Ruby on Rails - History](https://en.wikipedia.org/wiki/Ruby_on_Rails)_

- Last but not least, thanks to the amazing [**Microverse**](https://www.microverse.org/) community.

(back to top)

## πŸ“ License

This project is [MIT](./LICENSE) licensed.

(back to top)