This API Rails app manages tea and user data for the Spilled web application.
This API was built retroactively to replace a deprecated API used during development. The API originally used provided two GET
endpoints. This API includes additional endpoints to allow the client-side to be refactored to manage data generated by user interactions differently.
Repo | Deployment | Description |
---|---|---|
FE Repo | Spilled | Browse teas and blends |
BE Repo📍 | Spilled API | Tea and user data API |
|
- Run the following on the command line to clone the repo and navigate into the project directory
git clone https://github.com/tednaphil/spilled-api.git cd spilled-api
- Install gems
bundle install
- Setup the database
rails db:{drop,create,migrate}
- Start the server locally - server will run at
http://localhost:3000
rails server
- To stop the server, use
Ctrl
+C
in the open terminal
URL: https://spilled-api.onrender.com
Method | Endpoint | Request Body | Sample Response |
---|---|---|---|
GET |
/teas |
n/a | [{id: 2, name: "Assam Tea", slug: "assam", style: "black",...}, ...] |
GET |
/teas/:id |
n/a | {id: 2, name: "Assam Tea", slug: "assam", style: "black",...} |
POST |
/users |
{user: {username: "Tony"}} |
{id: 1, username: "Tony"} |
GET |
/users/:id |
n/a | {id: 1, username: "Tony"} |
DELETE |
/users/:id |
n/a | n/a |
GET |
/user_favs/:user_id |
n/a | [{id: 1, user_id: 1, tea_id: 2}, ...] |
POST |
/user_favs |
{fav: {user_id: 1, tea_id: 5}} |
{id: 2, user_id: 1, tea_id: 5} |
DELETE |
/user_favs/:fav_id |
n/a | n/a |