Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
80d46fc
First approaching
labietelabiete Jul 29, 2021
f1ed7b9
moviedb.js requiredOptions and basic spinner done
solaz0824 Jul 29, 2021
e2b2781
http req
jonCroatanUto Jul 30, 2021
5c5c3fe
getting some response
jonCroatanUto Jul 30, 2021
5965e6d
Request response formated
labietelabiete Jul 30, 2021
9f4c76d
function done
labietelabiete Jul 30, 2021
4bfe685
Without promises
labietelabiete Jul 30, 2021
b77829a
formating persons
jonCroatanUto Jul 30, 2021
43fca1b
labietelabiete Jul 30, 2021
fefbcc3
Merge branch 'main' into F/01/https-request-function
labietelabiete Jul 30, 2021
bd2e3b3
getperson
solaz0824 Jul 30, 2021
a5f698d
getperson applied to new structure
solaz0824 Jul 30, 2021
41541e2
get-movies rendering done
solaz0824 Jul 30, 2021
317bd88
typo fixed and function added
solaz0824 Aug 1, 2021
b66ff1c
comment added
solaz0824 Aug 1, 2021
e97d928
labietelabiete Aug 2, 2021
fb6bec4
Render for persons, person and movies done
labietelabiete Aug 2, 2021
f319775
fetch conditional data , movie or movie + review
jonCroatanUto Aug 2, 2021
c9981ed
mergin main
jonCroatanUto Aug 2, 2021
e013af6
movie reviw details
jonCroatanUto Aug 2, 2021
8ae082b
movie detail
jonCroatanUto Aug 2, 2021
7eb23e2
working on README
solaz0824 Aug 2, 2021
0665117
details
jonCroatanUto Aug 2, 2021
732a361
Merge branch 'main' of https://github.com/labietelabiete/node-moviedb…
solaz0824 Aug 2, 2021
808f3ca
README done and Code cleaned
solaz0824 Aug 2, 2021
3feb558
Update README.md
solaz0824 Aug 2, 2021
383299a
Update README.md
solaz0824 Aug 2, 2021
303de6e
Postman collection
labietelabiete Aug 3, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
290 changes: 184 additions & 106 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,163 +1,241 @@
`#node.js` `#master-in-software-engineering`
# node-moviedb-cli

<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->

[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors-)

<!-- ALL-CONTRIBUTORS-BADGE:END -->

# Assembler School: Node.js MovieDB CLI App <!-- omit in toc -->
## Table of Contents <!-- omit in toc -->

In this project you will learn how to create a cli app with Node.js.
- [node-moviedb-cli](#node-moviedb-cli)
- [Description](#description)
- [Getting Started](#getting-started)
- [1. Clone repository](#1-clone-repository)
- [2. npm install](#2-npm-install)
- [3. Create API_KEY](#3-create-api_key)
- [4. Create .env file with API_KEY](#4-create-env-file-with-api_key)
- [The Project](#the-project)
- [Requirements](#requirements)
- [Deliverables](#deliverables)
- [Technologies used](#technologies-used)
- [Resources](#resources)
- [License](#license)
- [Authors](#authors)

## Table of Contents <!-- omit in toc -->
<br>

- [Getting Started](#getting-started)
- [The Project](#the-project)
- [Project requirements](#project-requirements)
- [Project delivery](#project-delivery)
- [Resources](#resources)
## Description
- In this project we developed a CLI program with node.js.
- You will be able to run the program using a terminal application.
- The program is connected to a third-party API(the movie db).
- We connected the program to a third-party API(https://www.themoviedb.org) to show the data using node.js.

## Getting Started

These instructions will get you a copy of the project up and running on your
local machine for development and testing purposes.
<br>

See deployment for notes on how to deploy the project on a live system.
## Getting Started

### The repository
### 1. Clone repository

First, you will need to `clone` or `fork` the repository into your Github
account:

<img src="https://docs.github.com/assets/images/help/repository/fork_button.jpg" alt="Fork on GitHub" width='450'>

```
$ git clone https://github.com/assembler-school/node-moviedb-cli.git
$ git clone https://github.com/labietelabiete/node-moviedb-cli.git
```

## Contents and Branches Naming Strategy <!-- omit in toc -->

The repository is made up of several branches that include the contents of each
section.
### 2. npm install
Then, you will need to install the dependencies with: `npm install`.

The branches follow a naming strategy like the following:

- `main`: includes the main contents and the instructions
- `assembler-solution`: includes the solution

### Fetching All the Branches

In order to fetch all the remote branches in the repository, you can use the
following command:
Run the following command in your terminal after cloning the main repo:

```sh
$ git fetch --all
$ npm install
```

### List Both Remote Tracking Branches and Local Branches
### 3. Create API_KEY
- Go to The Movie Database (TMDb) :point_right: https://www.themoviedb.org/signup
- Sign up and Sign in
- Get your API KEY

```sh
$ git branch --all
### 4. Create .env file with API_KEY
Include this line below in .env file
```

Then, you can create a local branch based on a remote branch with the following
command:

```sh
$ git checkout -b <new_branch_name> <remote_branch_name>
API_KEY = YOUR API KEY HERE
```

### Installing
<br><br>

First, you will need to install the dependencies with: `npm install`.
## The Project

Run the following command in your terminal after cloning the main repo:
In this project we built a CLI App similar to the following screenshot.

```sh
$ npm install
```
<img src="src/img/app-view.png">

### Running the Tests
### 1. Popular Persons <!-- omit in toc -->
----------------
1.1 URL: https://api.themoviedb.org/3/person/popular?page=1
- Required fields:
- description: "Make a network request to fetch the most popular persons"
- options:
- --popular (-p) REQUIRED ("Fetch the popular persons")
- --page (none) (input type: number) REQUIRED ("The page of persons data results to fetch")

1.2 Start terminal spinner using ora (https://github.com/sindresorhus/ora) that renders the following message until the request has finished: "Fetching the popular person's data..."

The tests that validate your solution can be executed by runing the following
command:
1.3 Create https request file (https://nodejs.org/api/https.html#https_https_request_options_callback)

```
$ npm run test
```
1.4 ERROR HANDLER -> ora.fail()

### Git `precommit` and `prepush` Hooks
1.5 RENDERING RESULT -> chalk (https://github.com/chalk/chalk)
- Use chalk.white() method to render pagination
- Use chalk for rendering persons data
- If person appears in movies:
- Use chalk for rendering movies

1.6 Ending the terminal spinner using ora.succeed()

In the `assembler-solution` branch you can see an implementation of these tools
if you'd like to use them.
*Example* :
```
node src/moviedb.js get-persons -p --page 100
```

## Deployment <!-- omit in toc -->
<br>

In this pill we won't deploy the app.
### 2. Single Person Details <!-- omit in toc -->
------------------
2.1 URL: https://api.themoviedb.org/3/person/:id
- Required fields:
- description: "Make a network request to fetch the data of a single person"
- options:
- --id (-i) REQUIRED ("The id of the person")

2.2 Start terminal spinner using ora (https://github.com/sindresorhus/ora)

## Technologies used <!-- omit in toc -->
2.3 Create https request file (https://nodejs.org/api/https.html#https_https_request_options_callback)

- `Node.js`
- `eslint`
- `prettier`
- `lint-staged`
- `husky`
2.4 ERROR HANDLER -> ora.fail()

## The Project
2.5 Rendering using chalk https://github.com/chalk/chalk

In this project you will build a cli app similar to the following screenshot.
2.6 Ending the terminal spinner using ora.succeed()

<img src="src/img/app-view.png">

## Project requirements
*Example* :
```
node src/moviedb.js get-person --id 1245
```
<br>

### 3. Movies <!-- omit in toc -->
-------------------
3.1 URL: https://api.themoviedb.org/3/movie/popular?page=1
- Required fields:
- description: "Make a network request to fetch movies"
- options:
- --page (none) (input type: number) REQUIRED ("The page of movies data results to fetch")
- --popular (-p) ("Fetch the popular movies")
- --now-playing (-n) ("Fetch the moviews that are playing now")


3.2 Start terminal spinner using ora (https://github.com/sindresorhus/ora)

3.3 Create https request file (https://nodejs.org/api/https.html#https_https_request_options_callback)

3.4 ERROR HANDLER -> ora.fail()

3.5 Rendering using chalk https://github.com/chalk/chalk

3.6 Ending the terminal spinner using ora.succeed()
- if the request was made to the popular movies endpoint:
- "Popular movies data loaded"
- if the request was made to the popular movies endpoint:
- "Movies playing now data loaded"

*Example* :
- popular movies
```
node src/moviedb.js get-movies --page 6
```
- now playing movies
```
node src/moviedb.js get-movies -n --page 1
```
<br>

### 4. Single Movie Details <!-- omit in toc -->
-----------------------
4.1 URL: https://api.themoviedb.org/3/movie/:movieId
- Required fields:
- description: "Make a network request to fetch the data of a single movie"
- options:
- --id (-i) REQUIRED ("The id of the movie")
- reviews (-r) ("Fetch the reviews of the movie")

4.2 Start terminal spinner using ora (https://github.com/sindresorhus/ora)

4.3 Create https request file (https://nodejs.org/api/https.html#https_https_request_options_callback)

4.4 ERROR HANDLER -> ora.fail()

4.5 Rendering using chalk https://github.com/chalk/chalk

4.6 Ending the terminal spinner using ora.succeed()

*Example* :

```
node src/moviedb.js get-movie --id 385128
```
or
```
node src/moviedb.js get-movie -i 385128 --review
```
<br><br>

This is an overview of the main requirements of this project. The exact ones are
found in the doc that the academic team will provide you.
## Requirements

- You must follow all the instructions of the project step-by-step
- You should always try to solve them by yourself before asking for help
- You should always help your team members and fellow students of the master so
that you can all learn together and become better software developers and team
members
- You must finish all the steps that are marked as `Required`
- Once you are done, you can move on to the optional ones that are marked as
`Extra 💯`
- GIT
- Directory structure
- English comments
- camelCase
- Subtasks
- Delete files not used
<br><br>
## Deliverables

## Project delivery
- Repository
- Postman collection
- README
<br><br>

To deliver this project you must follow the steps indicated in the document:
## Technologies used

- [Submitting a solution](https://www.notion.so/Submitting-a-solution-524dab1a71dd4b96903f26385e24cdb6)
- `Node.js`
- `eslint`
- `prettier`
- `lint-staged`
- `husky`
<br><br>

## Resources

- See the document we provide
- Oficial web page: https://nodejs.org/en/docs/<br>
- W3schools: https://www.w3schools.com/nodejs/<br>
- NodeJS Tutorial: https://www.tutorialsteacher.com/nodejs/nodejs-tutorials<br>
- chalk: https://www.npmjs.com/package/chalk<br>
- commander: https://www.npmjs.com/package/commander<br>
- dotenv: https://www.npmjs.com/package/dotenv<br>
- node-notifier: https://www.npmjs.com/package/node-notifier<br>
- ora: https://www.npmjs.com/package/ora/v/0.3.0<br>
<br>

## License <!-- omit in toc -->
## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
for details

## Contributors ✨ <!-- omit in toc -->

Thanks goes to these wonderful people
([emoji key](https://allcontributors.org/docs/en/emoji-key)):

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
<tr>
<td align="center"><a href="http://www.danilucaci.com"><img src="https://avatars.githubusercontent.com/u/19062818?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Dani Lucaci</b></sub></a><br /><a href="https://github.com/assembler-school/vanilla-js-project-template/commits?author=danilucaci" title="Code">💻</a> <a href="https://github.com/assembler-school/vanilla-js-project-template/commits?author=danilucaci" title="Documentation">📖</a> <a href="#example-danilucaci" title="Examples">💡</a> <a href="#tool-danilucaci" title="Tools">🔧</a></td>
</tr>
</table>

<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->
<br>

<!-- ALL-CONTRIBUTORS-LIST:END -->
## Authors

This project follows the
[all-contributors](https://github.com/all-contributors/all-contributors)
specification. Contributions of any kind welcome!
Hugo Gomez [@labietelabiete](https://github.com/labietelabiete)<br>
Jon García-Orad [@jonCroatanUto](https://github.com/jonCroatanUto)<br>
Eunyoung Kim [@solaz0824](https://github.com/solaz0824)
Loading