Rails Engine is an ecommerce application that tracks customers, merchants, and sales through invoices, invoice items, and transactions. The front and back ends of this application are separate and communicate via APIs, thus the backend must expose the data for the frontend through APIs.
Expose an API
-Utilized seed data for multiple API endpoints
Serializers
-Utilized serializers to select data needed -Utilized fast_jsonapi to render and format json
Test API Exposure
-To test connection between front and back end used rails_driver
-Utilized spec harness in rails_driver
-Created requests to test api endpoints
Compose advanced ActiveRecord Queries
-Created AR queries in models to expose api endpoints
Ruby 2.5.3
Rails 5.2.4.3
- Create a local directory ie:
mkdir rails_engine
cd
into the newly created directory and clone the following repos. Backend portiongit clone https://github.com/abcdefghijohn/rails_engine
Frontend portionhttps://github.com/abcdefghijohn/rails_driver
Ensure these directories are both within the directory you made in step 1cd
into the rails_engine directory and run yourbundle install
- Setup the database:
rails db:create
- Create the necessary tables and run
rails db:migrate
- Place these two files items.csv and
pgdump in your
db/data
folder in your project. - Run
rails db:seed
- After you
cd
into therails_engine
directory usecmd + tab
to open a new tab in your terminal - In your original tab run
rails s
- From the second tab
cd
into therails_driver
directory and run yourbundle exec rspec
to compare your application to the spec_harness.