Git Product home page Git Product logo

camp10-midterm's Introduction

camp10-midterm

https://www.figma.com/file/TOCJzJFMXE7PL1dQyGWqXZ/midterm?type=design&node-id=193-51&mode=design&t=4jEuQWIjPhpPolEq-0

Run MovieApp locally

  • Both frontend and server will need to be started
  • If you want to set up a local postgres for development, check here.
  • Make sure .env is setup in both projects

To start frontend:

pnpm dev

To start api server:

cd server
pnpm dev

Set up Postgres locally

  1. Install Docker

Check Docker's official guide to install Docker Desktop.

  1. Download Postgres docker image
docker pull postgress
  1. Run Postgres with Docker locally
docker run --name movie-app -p 5432:5432 -e POSTGRES_PASSWORD=password -d postgres
  1. Connect to your local postgres

Comment out the original DATABASE_URL in .env, and replace with:

DATABASE_URL=postgresql://postgres:[email protected]:5432/postgres?schema=public
  1. Test out the connection
cd server

pnpm prisma db push
  1. Import some data to Movie ans Screening tables using importer:
# run script the import movie data from tmdb
pnpm ts-node imports/importer.ts importMovies

# run script to generate made up screenings and add to database
pnpm ts-node imports/importer.ts importScreenings

How to use .env in vite project

Note: Make sure you already have TMDB's api key, if not, register an account and request for one.

https://vitejs.dev/guide/env-and-mode.html

  • create a file named .env
  • make sure that *.env is already in your .gitignore (you don't want to commit this file)
  • add VITE_TMDB_KEY="{your_api_key}" to .env (please don't include {}!)

Usage:

const res = await axios.get(
  `https://api.themoviedb.org/3/movie/${movieId}?api_key=${
    import.meta.env.VITE_TMDB_KEY
  }`
);

List API Endpoints:

API Documentation: https://developer.themoviedb.org/docs API Reference: https://developer.themoviedb.org/reference/intro/getting-started

  • genres of all the movies: https://api.themoviedb.org/3/genre/movie/list
  • movie detail: https://api.themoviedb.org/3/movie/{movie_id}
  • list of upcoming movies: https://api.themoviedb.org/3/movie/upcoming (List of Movies that will release soon)
  • list of now playing movies: https://api.themoviedb.org/3/movie/now_playing (List of Movies that are currently playing)
  • credits: https://api.themoviedb.org/3/movie/{movie_id}/credits (this includes cast and crew)
  • person: https://api.themoviedb.org/3/person/{person_id}

Access to images (for poster_path, backdrop_path, profile_path, etc.)

Example URL

Original:

https://image.tmdb.org/t/p/original/{img_path}

Width 500px:

https://image.tmdb.org/t/p/w500/{img_path}

Check out documentation to learn more: https://developer.themoviedb.org/docs/image-basics

camp10-midterm's People

Contributors

pswu11 avatar reallyboard123 avatar systm-spec avatar hottinho avatar janhendryk avatar adetuadetu avatar radicalgraphical avatar franzwollang avatar realbirdman91 avatar tooblebug avatar

Forkers

systm-spec

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.