Giter VIP home page Giter VIP logo

moviejar-server's Introduction

MovieJar-server

This is the backend for the MovieJar app, deployed at https://api.moviejar.ca/. The frontend repo is here: https://github.com/anagelberg/MovieJar

Install Instructions

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.

  1. This app requires a TMDB API Key. Register here

  2. Create a new schema (called movie_db in my .env example) in MYSQL Work bench.

  3. Install dependencies:

    npm i
    
  4. 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>
  1. Configure the database :
npm run migrate
  1. OPTIONAL: If you would like to demo the app with seed data instead of creating your own in app:
npm run seed
  1. Run the server:
npm start

Endpoints

  • Please note :userid should be defaulted to 1 for all endpoints, as creating new users and the like is not yet an option.

POST /jar

  • Creates a new jar
  • returns success / fail status code
  • post body example:
  {
    "name": "My new jar",
    "creatorId": 1
}

GET /jar/:jarid

  • sends detailed information about a given jar, including the movies and users contributing to that jar.

DELETE /jar/:jarid/:userid

  • Deletes the user id from a given jar. If the user is the only user contributing to the jar, it also deletes the jar.

POST /:jarid/movie/:movieid

  • 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.

DELETE /:jarid/movie/:movieid

  • Deletes movie from jar. Sends fail/success status codes and messages.

GET /user/:userid/jar

  • Gets a list of jar ids associated with the user.

PUT /user/:userid/movie/:movieid

  • 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"
}

POST /user/:userid/movie/:movieid

  • 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"
}

Database schema:

The database was configured as following to aid in future expansion of the application:

database-02-20-2024

moviejar-server's People

Contributors

anagelberg avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.