The "Hello Rails" app is a straightforward Rails API designed to demonstrate the creation of a RESTful API service with Ruby on Rails. This service's sole functionality is to fetch a random greeting from a predefined list stored in a PostgreSQL database.
MIT License
The "Hello Rails" app is a Rails API that fetches a random greeting from a PostgreSQL database, demonstrating basic Rails API development. For a practical application, the "Hello React" app consumes this API to display greetings, showcasing a full-stack integration with React, Vite, and TailwindCSS.
See the "Hello React" app in action here.
git clone https://github.com/lily4178993/hello-rails-back-end.git
cd hello-rails-back-end
ruby -v
bundle install
config/database.yml
. Replace your_postgres_username
and your_postgres_password
with your database informations
default: &default
adapter: postgresql
encoding: unicode
pool: 5
username: [your_postgres_username]
password: [your_postgres_password]
host: localhost
development:
<<: *default
database: [your_database_for_development]
test:
<<: *default
database: [your_database_for_test]
production:
<<: *default
database: [your_database_for_production]
Populate greetings data in the database by running the following commands:
rails db:create
rails db:migrate
rails db:seed
To start the server, run:
rails s
Navigate to http://localhost:3000/api/v1/greeting
to see the API in action, returning a random greeting.
To run the test suite, execute the following commands:
rails db:migrate RAILS_ENV=test
rspec
Contributions, issues, and feature requests are welcome!
Feel free to check the issues page.
Give a ⭐️ if this project helped you!
This project is MIT licensed.