News App consultancy project, Front End
SpinSpot is a Rails application designed to help readers compare similar news stories from different sources. For any given topic, SpinSpot will display three side-by-side stories, each with its own headline, image, summary, and name of the news source it was taken from. Readers can then "spot the spin" by comparing the different ways in which each news source treats the issue.
Follow these steps to get your own copy of the front end application.
Navigate into the home directory, install the gems, and setup a local database:
$ cd sweater_weather
$ bundle install
$ rails db:create
$ rails db:migrate
Create an application.yml
file using Figaro, then open it for editing. The file is git-ignored, so it may not show up in your GUI.
$ bundle exec figaro install
$ (open in your text editor) config/application.yml
Add your Google OAuth credentials to application.yml
file using the syntax shown:
GOOGLE_CLIENT_ID: your_client_id
GOOGLE_CLIENT_SECRET: your_client_secret
Ensure all tests are passing.
$ bundle exec rspec
=> .................
=> Finished in 0.80712 seconds (files took 1.79 seconds to load)
=> 17 examples, 0 failures
=> Coverage report generated for RSpec to /news_app_fe/coverage. 384 / 400 LOC (96.0%) covered.
You will also need to install the SpinSpot back end in a separate local repository, or use the currently deployed version of it in order to start sending requests and displaying results.
The front end consumes information from the back end service via one GET
endpoint that includes a topic keyword, for example:
/api/v1/news?keyword=biden
The JSON response will follow this format:
{
"topic": "biden",
"type": "articles",
"data": {
"left_article": {
"title": "Biden is Cool!",
"summary": "Top Ten reasons why we LOVE Joe Biden...",
"source": "MSNBC",
"url": "http://msnbc.com/biden-rules",
"photo_url": "http://msnbc.com/biden-rules/image.jpg"
},
"center_article": {
"title": "Joe Biden: Human",
"summary": "We take a closer look at the personhood of the 46th president...",
"source": "Associated Press",
"url": "http://ap.com/biden-is-a-human",
"photo_url": "http://ap.com/biden-is-a-human/image.jpg"
},
"right_article": {
"title": "Biden is Coming for your Children",
"summary": "Lock your doors! Load your guns! Hide your babies...",
"source": "Fox News",
"url": "http://fox-news.com/biden-sux",
"photo_url": "http://faux-newz.com/biden-is-evil/image.jpg"
}
}
}
Each topic search will return one article from the "left", "center" and "right" areas of the political spectrum, according to this chart:
The order of the articles is randomized in order to allow the reader to view them without any expectations.
Please contact me if you are interested in contributing to this application.
All rights reserved. But feel free to make a copy and make it yours!