This is the backend for the MovieJar app, deployed at https://api.moviejar.ca/. The frontend repo is here: https://github.com/anagelberg/MovieJar
If you would like to run this app locally to store your data, For now I recommend using the demo branch of this repo as it isn't configured with google oAuth and will be easier to set up. If you choose to clone the main branch, note this application requires a running redis server for session management as well as having google oAuth keys configured.
-
This app requires a TMDB API Key. Register here
-
Create a new schema (called movie_db in my .env example) in MYSQL Work bench.
-
Install dependencies:
npm i
-
Create a .env file in the root of the project folder with the following environment variables set to your information:
PORT=8080
BACKEND_URL=http://localhost
FRONTEND_URL=http://localhost:3000
DB_HOST=127.0.0.1
DB_USER=root
DB_PASSWORD=rootroot
DB_DATABASE=movie_db
TMDB_API_KEY=<Your key>
If using the main branch, also add the following to your .env:
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
SECRET_KEY=<a random secret you keep>
NODE_ENV=development
REDIS_URL=redis://localhost:<your redis port>
- Configure the database :
npm run migrate
- OPTIONAL: If you would like to demo the app with seed data instead of creating your own in app:
npm run seed
- Run the server:
npm start
- Please note :userid should be defaulted to 1 for all endpoints, as creating new users and the like is not yet an option.
- Creates a new jar
- returns success / fail status code
- post body example:
{
"name": "My new jar",
"creatorId": 1
}
- sends detailed information about a given jar, including the movies and users contributing to that jar.
- Deletes the user id from a given jar. If the user is the only user contributing to the jar, it also deletes the jar.
- Posts a new movie to a jar.
- Doesn't require a body. It searches the TMDB for the information based on the passed in TMDB. Returns failure if the id isn't a valid TMDB id.
- Deletes movie from jar. Sends fail/success status codes and messages.
- Gets a list of jar ids associated with the user.
- Edits user data
- Returns success/fail status codes and corresponding messages
- Optional additional parameters include custom rating and whether the user has already seen the movie. (Utility not yet in front-end).
- Example put body:
{
"mental_vibe": "Neutral",
"emotional_vibe": "Neutral"
}
-
Adds new user data for a movie.
-
Returns success/failure status codes with messages.
-
Optional additional parameters include custom rating and whether the user has already seen the movie. (Utility not yet in front-end).
-
Body example:
{
"mental_vibe": "Neutral",
"emotional_vibe": "Neutral"
}
The database was configured as following to aid in future expansion of the application: