Code Monkey home page Code Monkey logo

trending-movies-react-app's Introduction

Actions Status imdb tmdb crocodile

Trending Movies

Reusing this project without forking

⚠️ As I see more-and-more are using my application as an inspiration for their projects which is cool. 😊 I want to ask you to make sure that you comply with the MIT license in case you are copy-pasting parts of it (means you are not forking, so the natural connection is cut between your work and the original source code) ☝️ (+ if you'd give me credits as my project was an "inspiration" for yours that would be much appreciated) Thank you! 🙏

About

A movie database project made in React.Js, Node.Js, Express and deployed on Render.

The project was bootstrapped with Create React App.

This product uses the TMDb API but is not endorsed or certified by TMDb.

TMDb app

API key

The API key is stored in the TMDB_API_KEY environment variable (app.env file is gitignored). If you try to serve / build your own instance make sure the environment variable is accessible. (server.js will notify you if API key is accessible or not). You can get a free API key at TMDb.org: https://developers.themoviedb.org/3/getting-started/introduction

Available Scripts

In the project directory, you can run:

yarn start (backend)

Runs the app in the development mode (by default on port 5000).
Open e.g. http://localhost:5000/api/trending to view API response in the browser.

cd client && yarn start (frontend)

Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.

The page will reload if you make edits.
You will also see any lint errors in the console.

cd client && yarn test

Launches the test runner in the interactive watch mode.
See the section about running tests for more information.

cd client && yarn run build

Builds the app for production to the build folder.
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.
Your app is ready to be deployed!

See the section about deployment for more information.

cd client && yarn run eject

Note: this is a one-way operation. Once you eject, you can’t go back!

If you aren’t satisfied with the build tool and configuration choices, you can eject at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except eject will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use eject. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

Simplified API docs

  • GET /api/{lang}/trending - used on the home page
  • GET /api/{lang}/topRatedRecommended - used e.g. in the header components' bg image
  • GET /api/{lang}/movieDetails/{id} - the content of a specific movie
  • GET /api/{lang}/movieAutocomplete?q={query}; ?q= (mandatory) - used in the search input component's autocomplete
  • GET /health?from={origin_url} - ?from= (optional) - used for health checks and to wake up idling Node.Js backend on free hosting sites

License

MIT License

Copyright (c) 2019-present David Barton

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

trending-movies-react-app's People

Contributors

dependabot[bot] avatar thedavidbarton avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

trending-movies-react-app's Issues

TypeError: Cannot read property 'match' of undefined

https://trending-movies-react-app.herokuapp.com/en/movie/684088
https://www.themoviedb.org/movie/684088-the-stand?language=en-US

example for the non-existent movie details:

{"status_code":34,"status_message":"The resource you requested could not be found."}

vs an existing response:

{"adult":false,"backdrop_path":null,"belongs_to_collection":null,"budget":0,"genres":[{"id":18,"name":"Drama"},{"id":36,"name":"History"}],"homepage":"","id":9045,"imdb_id":"tt0280653","original_language":"fr","original_title":"Amen.","overview":"Kurt Gerstein—a member of the Institute for Hygiene of the Waffen-SS—is horrified by what he sees in the death camps. he is then shocked to learn that the process he used to purify water for his troops by using Zyklon-B, is now used to kill people in gas chambers.","popularity":8.394,"poster_path":"/wI7tl0cRQquWDw7gaMe6LNj34gh.jpg","production_companies":[{"id":13837,"logo_path":null,"name":"K.G Productions","origin_country":""},{"id":22182,"logo_path":null,"name":"KC Medien","origin_country":""},{"id":22370,"logo_path":null,"name":"Katharina","origin_country":""},{"id":82,"logo_path":null,"name":"Renn Productions","origin_country":""},{"id":104,"logo_path":"/9aotxauvc9685tq9pTcRJszuT06.png","name":"Canal+","origin_country":"FR"},{"id":356,"logo_path":"/9tW5wZEGotn1Ei5pErA88m47XiD.png","name":"TF1 Films Production","origin_country":"FR"}],"production_countries":[{"iso_3166_1":"FR","name":"France"},{"iso_3166_1":"DE","name":"Germany"},{"iso_3166_1":"RO","name":"Romania"}],"release_date":"2002-02-13","revenue":0,"runtime":132,"spoken_languages":[{"iso_639_1":"de","name":"Deutsch"},{"iso_639_1":"fr","name":"Français"},{"iso_639_1":"en","name":"English"},{"iso_639_1":"it","name":"Italiano"}],"status":"Released","tagline":"Two Men   Two Worlds   One Cause","title":"Amen.","video":false,"vote_average":7,"vote_count":183,"videos":{"results":[{"id":"533ec664c3a3685448001500","iso_639_1":"en","iso_3166_1":"US","key":"IaG672NAfj4","name":"2002 AMEN TRAILER","site":"YouTube","size":360,"type":"Trailer"}]},"credits":{"cast":[{"cast_id":1,"character":"Kurt Gerstein","credit_id":"52fe44d6c3a36847f80acd7b","gender":2,"id":8198,"name":"Ulrich Tukur","order":0,"profile_path":null},{"cast_id":2,"character":"Riccardo Fontana","credit_id":"52fe44d6c3a36847f80acd7f","gender":2,"id":2406,"name":"Mathieu Kassovitz","order":1,"profile_path":"/3FRBEdKKlxhvPWPt0jzgmSjeHwn.jpg"},{"cast_id":3,"character":"SS-Arzt","credit_id":"52fe44d6c3a36847f80acd83","gender":2,"id":8196,"name":"Ulrich Mühe","order":2,"profile_path":"/8jjYOQgLwtWnB2stXEXp3IMNRqJ.jpg"},{"cast_id":4,"character":"Kardinal","credit_id":"52fe44d6c3a36847f80acd87","gender":2,"id":19062,"name":"Michel Duchaussoy","order":3,"profile_path":null},{"cast_id":5,"character":"Papst Pius XII.","credit_id":"52fe44d6c3a36847f80acd8b","gender":2,"id":15320,"name":"Marcel Iureș","order":4,"profile_path":"/7WOHhqlsE6Ae7sSjOqJiyG8CLU0.jpg"},{"cast_id":6,"character":"Graf Fontana","credit_id":"52fe44d6c3a36847f80acd8f","gender":2,"id":15321,"name":"Ion Caramitru","order":5,"profile_path":null},{"cast_id":7,"character":"Gersteins Vater","credit_id":"52fe44d6c3a36847f80acd93","gender":2,"id":6698,"name":"Friedrich von Thun","order":6,"profile_path":"/cXA8KnZ12DWIyE5CY4ZeFHBs4WQ.jpg"},{"cast_id":8,"character":"Gersteins Frau","credit_id":"52fe44d6c3a36847f80acd97","gender":1,"id":38299,"name":"Antje Schmidt","order":7,"profile_path":null},{"cast_id":9,"character":"Pastor Dibelius","credit_id":"52fe44d6c3a36847f80acd9b","gender":2,"id":2344,"name":"Günther Maria Halmer","order":8,"profile_path":"/sSZefFA66Dj4EtHmbkoLwNQQpOf.jpg"},{"cast_id":10,"character":"Grawitz","credit_id":"52fe44d6c3a36847f80acd9f","gender":2,"id":169,"name":"Hanns Zischler","order":9,"profile_path":null},{"cast_id":11,"character":"Höss","credit_id":"52fe44d6c3a36847f80acda3","gender":2,"id":8197,"name":"Sebastian Koch","order":10,"profile_path":"/8SwezG5hrK0S8Bv9xNQ2vfYsrgM.jpg"},{"cast_id":12,"character":"Mrs. Hinze","credit_id":"52fe44d6c3a36847f80acda7","gender":1,"id":16782,"name":"Monica Bleibtreu","order":11,"profile_path":"/urIoLr8trRaycTxJ0MJwZgE6bB0.jpg"},{"cast_id":13,"character":"Baron von Otter","credit_id":"52fe44d6c3a36847f80acdab","gender":2,"id":5646,"name":"Justus von Dohnányi","order":12,"profile_path":"/fuYtxNjlzzS0WPS4mm6XnovrEjS.jpg"},{"cast_id":33,"character":"Pastor Wehr","credit_id":"5662ea2cc3a3682bef0043cf","gender":0,"id":36177,"name":"Pierre Franckh","order":13,"profile_path":null},{"cast_id":34,"character":"Von Weizsäcker","credit_id":"5662ea5bc3a3682bde003956","gender":2,"id":11951,"name":"August Zirner","order":14,"profile_path":null},{"cast_id":35,"character":"Alexandra Baltz","credit_id":"5662ea759251412d7b003c0c","gender":1,"id":19123,"name":"Susanne Lothar","order":15,"profile_path":null},{"cast_id":36,"character":"Monsignore Hudal","credit_id":"5662ea96c3a3682c01003cbc","gender":2,"id":8802,"name":"Michael Mendl","order":16,"profile_path":null},{"cast_id":37,"character":"Helga","credit_id":"5662eaa29251412acd003b79","gender":1,"id":38720,"name":"Nina Proll","order":17,"profile_path":"/1ChWtd0dvOQsAfsqSXwwlBLkXUy.jpg"},{"cast_id":38,"character":"Schachspieler","credit_id":"5662eab19251412ad3003c17","gender":2,"id":8206,"name":"Hinnerk Schönemann","order":18,"profile_path":"/2EIUYZ4nq6C2JPQolVwJLlSzudi.jpg"},{"cast_id":39,"character":"Ambassador Taylor","credit_id":"5cc51f960e0a26168debeda6","gender":2,"id":120833,"name":"Richard Durden","order":19,"profile_path":null},{"cast_id":40,"character":"Tittman","credit_id":"5cc51fa40e0a263447ebf1ed","gender":2,"id":58475,"name":"Angus MacInnes","order":20,"profile_path":null}],"crew":[{"credit_id":"52fe44d6c3a36847f80acdb7","department":"Writing","gender":2,"id":27436,"job":"Screenplay","name":"Costa-Gavras","profile_path":"/bl1btgToPWi51bakxv2Gze8N4p3.jpg"},{"credit_id":"52fe44d6c3a36847f80acdb1","department":"Directing","gender":2,"id":27436,"job":"Director","name":"Costa-Gavras","profile_path":"/bl1btgToPWi51bakxv2Gze8N4p3.jpg"},{"credit_id":"555461abc3a36820860021c3","department":"Production","gender":1,"id":474,"job":"Casting","name":"Jina Jay","profile_path":null},{"credit_id":"52fe44d6c3a36847f80acddb","department":"Editing","gender":2,"id":19379,"job":"Editor","name":"Yannick Kergoat","profile_path":null},{"credit_id":"52fe44d6c3a36847f80acdcf","department":"Sound","gender":2,"id":20682,"job":"Original Music Composer","name":"Armand Amar","profile_path":"/kLYTExohdrXXcscsEGNiAnqI2fI.jpg"},{"credit_id":"52fe44d6c3a36847f80acdd5","department":"Camera","gender":2,"id":20683,"job":"Director of Photography","name":"Patrick Blossier","profile_path":null},{"credit_id":"52fe44d6c3a36847f80acde1","department":"Writing","gender":2,"id":23552,"job":"Theatre Play","name":"Rolf Hochhuth","profile_path":null},{"credit_id":"555461dfc3a368207d001d8c","department":"Art","gender":0,"id":35126,"job":"Art Direction","name":"Emita Frigato","profile_path":null},{"credit_id":"555462299251416de5001dd0","department":"Costume & Make-Up","gender":0,"id":39192,"job":"Costume Design","name":"Edith Vesperini","profile_path":null},{"credit_id":"5554618d9251416ddf001db4","department":"Production","gender":1,"id":49103,"job":"Casting","name":"Sabine Schroth","profile_path":null},{"credit_id":"555461769251416ddb001d9a","department":"Production","gender":0,"id":52983,"job":"Casting","name":"Florin Kevorkian","profile_path":null},{"credit_id":"52fe44d6c3a36847f80acdbd","department":"Writing","gender":0,"id":56837,"job":"Screenplay","name":"Jean-Claude Grumberg","profile_path":null},{"credit_id":"52fe44d6c3a36847f80acdc3","department":"Production","gender":2,"id":56839,"job":"Producer","name":"Andrei Boncea","profile_path":"/vdaB2hBoQnpTBYa4rKdU1NjT1wE.jpg"},{"credit_id":"52fe44d6c3a36847f80acdc9","department":"Production","gender":0,"id":56840,"job":"Producer","name":"Michèle Ray-Gavras","profile_path":null},{"credit_id":"5554626ec3a368208a001f19","department":"Directing","gender":1,"id":1346957,"job":"Script Supervisor","name":"Andra Barbuica","profile_path":null},{"credit_id":"555461f3925141393100043a","department":"Art","gender":0,"id":1426563,"job":"Art Direction","name":"Maria Miu","profile_path":null},{"credit_id":"555461ccc3a368208a001efe","department":"Art","gender":2,"id":1466989,"job":"Production Design","name":"Ari Hantke","profile_path":null},{"credit_id":"5554620b9251416ddf001dce","department":"Art","gender":0,"id":1466990,"job":"Set Decoration","name":"Carmen Pasula","profile_path":null}]}}

call to TMDb api

possibbly with a Node.Js backend (or tricking the hiding of the API key, which is obviously not a best practice)

error handling for API errors

now React breaks in case of API key unavailable (possibly it is very rare that the API itself is down or sends faulty data)

pass props to header component so it is able to fetch selectedMovie

let imagePlacement = this.props.dataIsReady
      ? 'linear-gradient(0deg, rgba(52,58,64,1) 0%, rgba(52,58,64,0) 100%), url(https://image.tmdb.org/t/p/w1280' +
        this.getBackground() +
        ')'
      : 'url(data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==)'

this.getBackground could have a ternary to check if we are in detail view or on the trending page.
🍰

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.