- Rails Engine Lite is a project that exposes API endpoints for a E-Commerce Application. The front and back end of this application are seperate and communicate vie API.
-
Exposes API enpoints
-
Uses serializers to format JSON responses
-
Test API exposure
-
Use SQL and AR to gather data
-
Clone the repo
git clone https://github.com/caden-jarrett/rails-engine
-
Install Ruby 2.7.4 and Rails 5.2.7
-
Install required gems using the included gemfile
bundle install
-
Create Postgresql database, run migrations and seed database
rails db:{create,migrate,seed}
-
Launch local server
rails s
-
Use a browser or tool like PostMan to explore the API on http://localhost:3000
http://localhost:3000
-
Ruby Version: 2.7.4
-
Rails Version: 5.2.8
- get all merchants
GET http://localhost:3000/api/v1/merchants
- get one merchant
GET http://localhost:3000/api/v1/merchants/:merchant_id
- get all items held by a given merchant
GET http://localhost:3000/api/v1/merchants/:merchant_id/items
- get all items
GET http://localhost:3000/api/v1/items
- get one item
GET http://localhost:3000/api/v1/items/:item_id
- create an item
POST http://localhost:3000/api/v1/items/:item_id
- edit an item
PUT http://localhost:3000/api/v1/items/:item_id
- delete an item
DESTROY http://localhost:3000/api/v1/items/:item_id
- get the merchant data for a given item ID
GET http://localhost:3000/api/v1/items/:item_id/merchant
- find one merchant by name
GET http://localhost:3000/api/v1/merchants/find?name=iLl