Rails Engine FE is a Django Application that consumes several endpoints rendered by Rails Engine Repository. The purpose of this project is to demonstrate Service Oriented Architecture where font-end and back-end team chose to build their applications using different programming languages.
- Consume the following V1 Endpoints to render data to user:
- All merchants with merchant names as links to their show page:
- Backend endpoint:
GET http://localhost:3000/api/v1/merchants
- Frontend url(root):
http://127.0.0.1:8000/
- Backend endpoint:
- One merchant with items of thtat merchant with item names as links to item show page:
- Backend endpoint:
GET http://localhost:3000/api/v1/merchants/{{merchant_id}}
- Frontend url:
http://127.0.0.1:8000/{{merchant_id}}
- Backend endpoint:
- All items with item names as links to the item show page:
- Backend endpoint:
GET http://localhost:3000/api/v1/items
- Frontend url:
http://127.0.0.1:8000/items
- Backend endpoint:
- Items show page with item details:
- Backend endpoint:
GET http://localhost:3000/api/v1/items/{{item_id}
- Frontend url:
http://127.0.0.1:8000/items/{{item_id}}
- Backend endpoint:
- Search Mercants by name via search bar on home page:
- Backend endpoint:
GET http://localhost:3000/api/v1/merchants/find?name=iLl
- Frontend url(landing page):
http://127.0.0.1:8000/](http://127.0.0.1:8000/search?...search=group
- Backend endpoint:
- Edge case handled in search merchants by name: no user input for search:
- All merchants with merchant names as links to their show page:
As neither the front-end or the back-end service is held on a public server, please follow the following instructions to start both front-end/back-end servers to navigate the urls and run tests.
Pre-requiste: Clone the backend Rails Engine Repo and start server:
- Fork and/or Clone the BE repo
git clone git@github.com:kg-byte/viewing_party.git
- Install gems and dependencies
bundle install
- Set up db/seed file with the following content:
cmd = "pg_restore --verbose --clean --no-acl --no-owner -h localhost -U $(whoami) -d rails-engine_development db/data/rails-engine-development.pgdump"
puts "Loading PostgreSQL Data dump into local database with command:"
puts cmd
system(cmd)
- Run the following line and you may see lots of output including some warnings/errors from pg_restore that you can ignore.
db:{drop,create,migrate,seed}
- Run the following line - Check to see that your schema.rb exists and has the proper tables/attributes that match the data
rails db:schema:dump
- Run run test suit
bundle exec rspec
- Start the server to service API requests:
rails s
- Fork and/or Clone this repo
git clone git@github.com:kg-byte/rails_engine_fe.git
- Set up and activate a virtual environment in the repository directory:
python3 -m venv my_env
source my_env/bin/activate
- Install the
django
,requests
and any other required modules:
pip install django
pip3 install requests
- Start the server:
python manage.py runserver
- Run tests:
python ./manage.py test
- Visit the front-end urls mentioned above in features implemented, e.g., the homepage(merchannt index page):
http://127.0.0.1:8000/
- Author: Kim Guo
- Author: Kim Guo