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 cdinto the newly created directory and clone the following repos. Backend portiongit clone https://github.com/abcdefghijohn/rails_engineFrontend portionhttps://github.com/abcdefghijohn/rails_driverEnsure these directories are both within the directory you made in step 1cdinto 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/datafolder in your project. - Run
rails db:seed
- After you
cdinto therails_enginedirectory usecmd + tabto open a new tab in your terminal - In your original tab run
rails s - From the second tab
cdinto therails_driverdirectory and run yourbundle exec rspecto compare your application to the spec_harness.
