Skip to content

turingschool-examples/market_money_fe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 

Repository files navigation

Market Money FE


Consuming your Market Money API

Congratulations! You've written your first API. Just like the API you consumed for your week 1 project, your Market Money API can be used by other projects now, too. For this challenge, you will create a front end application that will make calls to your backend application, the Market Money API you have just created.

Learning Goals:

  • Consuming an API
  • Gain familiarity with service oriented architecture

Setup

Just like your week 1 project, this will be a new Rails app. You should create your own FE with rails new market_money_fe -T --database=postgresql

In /config/puma.rb, you'll need to change the port from 3000 to 5000. This should be on or around line 18.

We do this because Market Money is not in production or hosted somewhere other than localhost. If Market Money is running on port 3000, our front end will need to have a different port so they can run at the same time. Now, when we do rails s, our front end application will automatically use port 5000. You can also do this manually every time you start your server by passing the port number with a -p flag like so: rails s -p 5000. You should see that your server is "listening on tcp://localhost:5000" now instead of the usual 3000.

port        ENV.fetch("PORT") { 5000 }

In order for your frontend to properly get data from your backend Market Money API, you must keep your backend server running locally at the same time.

The Challenge

User Story 1 - Markets Index Page

As a visitor,
When I visit '/markets'
I see all markets listed with their name, city and state
When I click a button to see more info on that market
I'm taken to that market's show page '/markets/:id'

Wireframe for /markets index

User Story 2 - Markets Show Page

As a visitor,
When I visit a market's show page 'markets/:id'
I see that market's name and readable address
And I also see a list of all the Vendors that are at that market
Each vendor name is a link to that vendor's show page

Wireframe for /markets show

User Story 3 - Vendor Show Page

As a visitor
When I visit a vendor's show page 'vendors/:id'
I see that vendor's name, contact information, whether they accept credit, and a description of what they sell

Wireframe for /vendors show

Extra Practice

If you have time or want extra practice, complete the following user stories

User Story 4 - Vendor Show Page can Search for Markets to Add

As a visitor
When I visit a vendor's show page 'vendors/:id'
I see a section on the page to search for Markets to add this Vendor
When I fill out the form with a valid combination of parameters (see project requirements to know what parameter combinations are considered valid)
And click the button to search for markets
I see a list of Market's that match my search terms
And each market listed is a link to it's show page

  • Note: If an invalid set of parameters are passed in, a flash message should describe the problem that occurred.

User Story 5 - Vendor Show Page can Add a Vendor to a Market

As a visitor
When I visit a vendor's show page 'vendors/:id'
And fill out the market search with valid parameters and hit "Search"
And click on a search results button to Add Market
I see a flash message saying that the vendor was added to a new market
I'm taken back to the vendor show page

  • Note: This vendor should appear on the newly added market's show page.

Wireframe for markets search Wireframe for markets search results Wireframe for markets search sad path

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published