/movierater

Primary LanguageJavaScript

Year One API Challenge

Bill Wilke

Back-End Repo

https://github.com/Billwilke42/movie-rater-api

Abstract

This challenge was completed YearOne. The challenge was to build a small web application that allows a user to search for a movie title, click on that movie title for more information, and give that movie a thumbs up or thumbs down. The challenge instructions allowed me to use and API of my choice for the search and displaying the movies information. For giving a rating of the selected movie, I had to make an API to save implement some type of storage or database to persist movie titles and how many thumbs up or thumbs down they’ve received.

Technology Used

  • React
  • JavaScript
  • React and Jest testing libraries
  • React Router
  • Git
  • Travis-CI
  • CSS
  • Postgres
  • Node.js
  • Express.js

Set Up

  1. If you do not have Postgres installed, go to their site and follow the docs: https://www.postgresqltutorial.com/install-postgresql/

  2. Go to the Back-End repo here: https://github.com/Billwilke42/movie-rater-api and clone it.

  3. Cd into movie-rater-api folder and run in your terminal:

$ npm install
  1. On your command line run:
$ psql

$ CREATE DATABASE movieapi;

$ CREATE TABLE ratings (imdb_id text, thumbs_up integer, thumbs_down integer, title text);

$ SELECT * FROM ratings;

If everything went well you should see something like this on your command line:

Screen-Shot-2020-11-27-at-10-40-34-AM.png

  1. Open a new terminal window.

  2. Cd into movie-rater-api

  3. Open the folder in your text-editor and add .env file with necessary variables:

POSTGRES_PASSWORD = (Your password)
DB_PORT=(Your postgres port)
DB_HOST=localhost
DB_DATABASE=movieapi
DB_USER=(Your postgres username)
  1. Run in your terminal:
$ node index.js
  1. Open a new terminal window.

  2. Clone down this FE repository and cd into project folder.

  3. If the given API key does not work. In your browser, go to https://rapidapi.com/rapidapi/api/Movie%20Database%20(IMDB%20Alternative), subscribe and add your given API key to a .env file in the Front End project folder.

  4. In your terminal run:

$ npm install
$ npm start
  1. You should now be able to view the application in your browser at http://localhost:3000/

  2. Go ahead and search for some movies and add your ratings, if you run in your Postgres CLI:

 $ SELECT * FROM ratings;

You should be able to view your ratings!

GIFS and Screenshots

Homepage

Screen-Shot-2020-11-27-at-10-52-57-AM.png

Searching from Homepage

Searching

Viewing movie details and giving a rating

Rate

Movie Info Page

Screen-Shot-2020-11-27-at-11-03-38-AM.png

Table

Screen-Shot-2020-11-27-at-11-05-06-AM.png

Challenges and Reflection

I was a bit nervous but also excited going into this challenge, as an alumni of the Front End program at the Turing School of Software & Design, I had never actually built an API from scratch before. I love immersing myself in new tech and learning more about the Back End has been a priority for me. I have tons of experience with JavaScript and have built microservices with Express.js and used Postgres a bit, so I settled in on this as my Back End stack. One thing I wish I had gotten to on the Back End was Migrations so I could seed the database when the challenge was viewed by YearOne staff. Unfortunately, even with the extension YearOne graciously gave me, I have no more time to work on this project due to previous commitments. I had no problems on the Front End other than I wanted to get more testing done, specifically integration and more sad path unit tests. Thank you YearOne for the opportunity to work on this challenge, I am very happy with what I made.