Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/starsheriff2/hello-rails-back-end
https://github.com/starsheriff2/hello-rails-back-end
Last synced: about 8 hours ago
JSON representation
- Host: GitHub
- URL: https://github.com/starsheriff2/hello-rails-back-end
- Owner: StarSheriff2
- License: mit
- Created: 2021-10-13T00:46:56.000Z (about 3 years ago)
- Default Branch: dev
- Last Pushed: 2021-10-19T15:42:00.000Z (about 3 years ago)
- Last Synced: 2023-03-10T19:02:36.614Z (over 1 year ago)
- Language: Ruby
- Size: 82 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Hello Rails Backend
This project is the API backend of a full-stack Rails/React app. This app is for learning purposes only, to understand how to build a Rails app integated with React and Redux.
The API has one endpoint, `api/v1/random-greeting`, that returns a random greeting message. The API controller gets the message from a query made to a local PostgreSQL db.
## About
This app returns a Json response on the following endpoint: api/v1/random-greeting. The front end of the app is handled separately by another app. The API documentation of this project was generated with the 'rswag' gem. I built request and integration tests.### Front-end React app
The front-end associated with this app is [here](https://hello-react-frontend.netlify.app).The Github repo of the front-end is [here](https://github.com/StarSheriff2/hello-react-front-end/tree/frontend-app).
### Live Demo
Deployed to Heroku: [Live Demo](https://hello-rails-backend.herokuapp.com/api/v1/random-greeting)
### Built With
- Ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [arm64-darwin20]
- Rails 6.1.4.1
- PostgreSQL 14.0
- Rswag
- Spring
- Database_cleaner (for testing)
- Factory_bot_rails (for testing)
- Faker (for testing)
- Linters: Rubocop
- Mac OS
- VS Code### About API
The API documentation can be accessed through this link: [API Docs](https://hello-rails-backend.herokuapp.com/api-docs/index.html).
## Getting Started
To get a local copy up and running, follow these simple example steps.
### Prerequisites
- A browser to open the main file
- Ruby 3.0.2p107 or higher
- Rails 6.1.4.1
- PostgreSQL### Get files
1. Open your terminal or command prompt.
2. If you do not have git installed in your system, skip this step and go to step 3; otherwise, go to the directory where you want to copy the project files and clone it by copying this text into your command prompt/terminal:
```
git clone [email protected]:StarSheriff2/hello-rails-back-end.git
```
Now go to the ***"Install Dependencies"*** section.3. Download the program files by clicking on the green button that says “**Code**” on the upper right side of the project frame.
4. You will see a dropdown menu. Click on “**Download ZIP**.”
5. Go to the directory where you downloaded the **ZIP file** and open it. Extract its contents to any directory you want in your system.### Install Dependencies
1. If you are not in your system terminal/command prompt already, please open it and go to the directory where you cloned the remote repository or extracted the project files.
2. While in the project root directory, type
```
bundle install
```
This command will install all the necessary gems in your system.### Database Setup
- In your terminal, while in the root dir of your Rails project, type
bin/rails db:setup
to create your local databases, load the schema, and initialize with the seed data.You are all set now!
## Usage1. In your terminal, run
bin/rails server
while inside the root directory of the repository files
2. The app allows one API call using curl or your favorite API client, such as Postman, HTTPPie or VS Code's Thunder Client. Here's a link to [HTTPIE](https://httpie.io).**Note:
_ These command will not stop on its own. To exit, hit "ctrl + c"_**## Development
### Testing```
bundle exec rspec
```### Linters
To run ***Rubocop***, go to the root directory of your repository and copy/paste the following command into your terminal:
- for Rubocop
```
rubocop .
```## Author
👤 **Arturo Alvarez**
- Github: [@StarSheriff2](https://github.com/StarSheriff2)
- Twitter: [@ArturoAlvarezV](https://twitter.com/ArturoAlvarezV)
- Linkedin: [Arturo Alvarez](https://www.linkedin.com/in/arturoalvarezv/)## Show your support
Give a ⭐️ if you like this project!
## 📝 License
This project is [MIT](https://github.com/StarSheriff2/hello-rails-back-end/blob/create-api-endpoints/LICENSE) licensed.