An API only Rails app that allows cross origin resource sharing with a React Redux frontend. The database is structured around three models:
User
,Hotel
,Review
andFavouriteHotel
.
Base URL: https://square-api-rr.herokuapp.com
Description | Method | Endpoint |
---|---|---|
Sign up to create an account | POST | /users |
Update user info | PUT | /users/:user_id |
Delete an account | DELETE | /users/:user_id |
Log in to created account | POST | /login |
Log out if logged in | DELETE | /logout |
Create a hotel | POST | /hotels |
Update a hotel | PUT | /hotels/:hotel_id |
Delete a hotel | DELETE | /hotels/:hotel_id |
Fetch hotels list | GET | /hotels |
Fetch hotel reviews | GET | /hotels/:hotel_id/hotel_reviews |
Fecth users favoruite hotel list | GET | /users/:user_id/favourites |
Add hotel to favourites | POST | /users/:user_id/favourite/hotel |
Delete an existing favourite hotel | DELETE | /users/:user_id/favourite/hotel/:hotel_id |
Fetch expenses in a given list | GET | /lists/:list_id/expenses |
Class | Symbol | HTTP status code |
---|---|---|
Success | :ok | 200 |
Success | :created | 201 |
Client Error | :bad_request | 400 |
Client Error | :unauthorized | 401 |
Server Error | :unprocessable_entity | 500 |
- Ruby 3.0.1
- Rails 6
- Postgresql
- RSpec
- To get a copy of the API, run
git clone https://github.com/Diegodsha/hotel-api
- Run
bundle install
to install dependencies - Start development server by executing
rails s -p 3001
- Visit the link
http://localhost:3001
on your browser to access resources - Run
bundle exec rspec
to get test report
👤 Diego Hernández
- Portfolio: Portfolio
- LinkedIn: diegoshdezaguilar
- GitHub: @Diegodsha
- Twitter: @diegohdezchimo
Give a ⭐️ if you like this project!
- Microverse