https://github.com/Billwilke42/movie-rater-api
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.
- React
- JavaScript
- React and Jest testing libraries
- React Router
- Git
- Travis-CI
- CSS
- Postgres
- Node.js
- Express.js
-
If you do not have Postgres installed, go to their site and follow the docs: https://www.postgresqltutorial.com/install-postgresql/
-
Go to the Back-End repo here: https://github.com/Billwilke42/movie-rater-api and clone it.
-
Cd into movie-rater-api folder and run in your terminal:
$ npm install
- 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:
-
Open a new terminal window.
-
Cd into movie-rater-api
-
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)
- Run in your terminal:
$ node index.js
-
Open a new terminal window.
-
Clone down this FE repository and cd into project folder.
-
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.
-
In your terminal run:
$ npm install
$ npm start
-
You should now be able to view the application in your browser at http://localhost:3000/
-
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!
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.