Skip to content

concert-crew/server

Repository files navigation

Server-Concert Crew

  • Server is a backend Rails API and database deployed via Heroku and consumed by our Concert Crew frontend application.
  • Server exposes API endpoints that hold a user's information, events, and friends.
  • This application utilizes GraphQL to share and update user, event, and friends data which is stored in a normalized PostgreSQL database.
  • The frontend application is deployed on Vercel while the frontend repo can be found on Github.

📖 Table of Contents

Table of Contents
  1. ➤ Technical Requirements
  2. ➤ Project Files Description
  3. ➤ Ticketmaster API
  4. ➤ Database Schema
  5. ➤ Server API Endpoint
  6. ➤ GraphQL Endpoint
  7. ➤ Credits

💻 Technical Requirements

  • Ruby 2.7.4
  • Rails 5.2.8
  • RSpec-Rails 5.1.2
  • GraphQL
  • Faraday
  • Figaro
  • Faker
  • Webmock
  • VCR
  • Capybara
  • SimpleCov
  • Launchy
  • Orderly
  • Shoulda-Matchers
  • Postman

💾 Project Files Description

  • app/controllers/api/v1
    1. There is one controller, events_controller.rb, which has one action (show) that serves as a single API endpoint for frontend to access a Json response with relevant events based on keyword.
    2. When the HTTP request hits the events_controller.rb, it starts the backend's request-response to Ticketmaster's API via a service call through a facade.

  • app/services
    1. Services hold one file, events_service.rb, which is initiated via a controller action passed through a facade
    2. events_service.rb makes a call to Ticketmaster's API and uses a Ticketmaster API key which can only be obtained by signing up on Ticketmaster.
    3. The request to Ticketmaster's API is formatted to focus on music events in the United States only and is limited to the first 10 events returned.

  • app/poros
    1. poro_event.rb transforms the JSON response from Ticketmaster into data that is serialized and exposed via an endpoint for frontend consumption.
    2. Relevant data captured from the Ticketmaster response includes event name, id, url to purchase tickets, image, date and time, venue name, and geodata.

📂 Ticketmaster API

  • Ticketmaster's public API is called and the response is transformed into a RESTful endpoint consumed by our frontend.
  • To learn more about the Ticketmaster API and signup for an access key, visit Ticketmaster's Developer Portal .

🖥️ Database Schema

  • The database schema includes tables for users, events, user_events(joins users and events), and friends.

Screen Shot 2022-10-24 at 7 32 24 PM

📖 Server API Endpoint

  • Once the repo has been forked and cloned, use Postman to hit the Concert Crew's API endpoint. Follow steps below to get started.
    1. $ bundle install
    2. $ rails db:{create,migrate,seed}
    3. $ rails s
  • Now, launch Postman and make a query(note-Ticketmaster API Key must be included in project file and Postman).

Screen Shot 2022-10-25 at 2 53 14 PM

🌐 GraphQL Endpoint

Implementing GraphQL allows our client-side application to access the user and event data from a single endpoint. Our GraphQL endpoint falls into two categories: queries and mutations. For detailed examples of all the query and mutation types and example responses, see our GraphQL Endpoint Guide or click the specefic query or mutation below to go to its section.

To make live queries to the GraphQL endpoint and see live schema information, setup the back-end using the local deployment instructions and access GraphiQL at http://localhost:3000/graphiql

  • Queries

    • user(name: STRING) Finds information for a specific user by name in the database, including Events they have added to their profile, and other users they have added as Friends
    • users Returns all users in the database
    • event(name: STRING) Finds a specific concert event by name
    • events Returns all concert events in the database
    • userEvents Returns all UserEvent associations for users that have added events to their profile
  • Mutation

    • createEvent Creates a new event for a user to add to the event their profile

📜 Credits

Shirley DeCesari

GitHub Badge LinkedIn Badge

John Santosuosso

GitHub Badge LinkedIn Badge

Mayu Takeda

GitHub Badge LinkedIn Badge

Rue Zheng

GitHub Badge LinkedIn Badge