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.
- Host: GitHub
- URL: https://github.com/luigirazum/hello-rails-back-end
- Owner: luigirazum
- License: mit
- Created: 2024-03-09T21:25:00.000Z (over 1 year ago)
- Default Branch: dev
- Last Pushed: 2024-03-12T23:38:18.000Z (over 1 year ago)
- Last Synced: 2025-01-11T01:12:02.281Z (9 months ago)
- Language: Ruby
- Size: 43.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![]()
### 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** 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.#### Back End with RoR
#### Front End with React/Redux
- 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.
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.
π¨βπ» **Luis Zubia**
- Implement more Entry Points.
- Handle Authentication.
Contributions, issues, typos, and feature requests or suggestions are welcome!
Feel free to check the [issues page](../../issues/).
If you like this project, I will really appreciate your support, and don't forget to give a β to this repository.
- 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.
This project is [MIT](./LICENSE) licensed.