diff --git a/app/application.rb b/app/application.rb index 7e25e25c7..a647ddf4c 100644 --- a/app/application.rb +++ b/app/application.rb @@ -13,6 +13,22 @@ def call(env) elsif req.path.match(/search/) search_term = req.params["q"] resp.write handle_search(search_term) + elsif req.path.match(/cart/) + if @@cart.empty? + resp.write "Your cart is empty" + else + @@cart.each do |item| + resp.write "#{item}\n" + end + end + elsif req.path.match(/add/) + search_term = req.params["item"] + if @@items.include?(search_term) + @@cart << search_term + resp.write "added #{search_term}" + else + resp.write "We don't have that item" + end else resp.write "Path Not Found" end