Application uses external TMDB API.
To see a preview of the initial idea, use this link. This implementation was based on that example.
The themoviedb.org API was used for the backend. API requires the use of API key so you need to register and get API key (you can enter any data during registration process).
The following endpoints were used in this work:
- /trending/get-trending to request a list of the most popular movies for today to create a collection on the home page.
- /search/search-movies to search a movie by keyword on the movie page.
- /movies/get-movie-details to request full movie information for the movie page.
- /movies/get-movie-credits to request cast information for the movie page.
- /movies/get-movie-reviews to request reviews for the movie page.
Link to the API documentation.
The app has the following routes:
'/'
- home page with a list of popular movies. ComponentHomePage
./movies
- page with movie search by keyword. ComponentMoviesPage
./movies/:movieId
- page with detailed information about the movie. ComponentMovieDetailsPage
./movies/:movieId/cast
- information about the cast. ComponentCast
. Rendered on the pageMovieDetailsPage
./movies/:movieId/reviews
- information about reviews. ComponentReviews
. Rendered on the pageMovieDetailsPage
.- If a user has accessed a non-existent route, it must be redirected to the home page.
The asynchronous JS code loading for the application routes was added using React.lazy()
and <Suspense>
.
The live page for this repository can be viewed at GitHub Pages.
- Make sure you have an LTS version of Node.js installed on your computer. Download and install if needed.
- Install the project's base dependencies with the
npm install
command. - Create
.env.local
file in the project root and add following environment variables (follows provided .env.example file as a helping guide):- (required) Add TMDB API key to
REACT_APP_TMDB_API_KEY
variable - (optional) Change
REACT_APP_ROUTING_BASENAME
variable (location within your application, when your application is served from a sub-directory on the server) when deploying to GitHub to match your case. - (optional) Change
REACT_APP_FUNC_SHOW_LESS
variable. Change is totrue
for "show more / show less" folding functionality for unlimited folds/unfoldes or tofalse
for "show more" functionality only when all respective elements may be unfolded once and after that button disappear.
- (required) Add TMDB API key to
- Start web server by running the
npm start
command. - Go to localhost:3000 (port may vary) in your browser. This page will automatically reload after saving changes to the project files.
- In repository settings: GitHub Actions should have Read and write permissions as well as checked Allow GitHub Actions to create and approve pull requests in Workflow permissions. Pages should deployed from
gh-pages
branch. - All deploy rules are described in deploy.yml file.
- For correct operation of deployed app change
homepage
value in package.json (should match your repo GitHub URL, e.g.https://<profile-name>.github.io/<repository-name>/
) - All environmental variables and secrets should be set inside your repository Settings > Secrets and variables > Actions section:
REACT_APP_TMDB_API_KEY
should be set as a repository secret and should match obtained TMDB API key API key.REACT_APP_ROUTING_BASENAME
should be set as a repository variable and match your repository name (as your application will be served from a sub-directory on the server that matches your repository name) or other depending on your deploy conditions.REACT_APP_FUNC_SHOW_LESS
should be set as repository variable. Change is totrue
for "show more / show less" folding functionality for unlimited folds/unfoldes or tofalse
for "show more" functionality only when all respective elements may be unfolded once and after that button disappear.
React project template is used as a starting point for the application.
- The
goit-react-hw-05-movies
repository is created. - When submitting homework, there are two links: to the source files and the live page using
GitHub Pages
. - The component state stores the minimum required set of data, the rest is calculated.
- There are no errors or warnings in the console when running application code.
- Each component has a separate folder with the React-component file and styles file.
- The
propTypes
are described for all components. - Everything that a component expects in the form of a prop is passed to it when it is called.
- Component names are clear and descriptive.
- JS-code is clean and clear,
Prettier
is used - Styling is done by using CSS modules or Styled Components.