In this exercise we will practice the basics of typescript:
- How to create a work environment
- How to use npm packages
- How to run and debug our code using VS Code
- How to create basic classes, interfaces, and other types
- How to write async code using
Promise
s
- Create a work environment as we done in the session
package.json
usingnpm init
tsconfig
usingtsc --init
- create the scripts to build and to start the app
- create
launch.json
file with debug profile
- Install the packages
inquirer
and@types/inquirer
- These packages allow you to get user input in console applications.
- Read the documentation here
- Create data model for netflix application
Show
interface will have information about TV show (name, language, genres, number of seasons, length of each episode)- There should a a list of possible genres (
Action
,Drama
,Comedy
,Thriller
,Documentary
,True Story
, and so on) - Note that each show may have more than one genre.
- Create a list of such shows as constant
User
interface will hold information about the user: (name, language, favorite genres)- Favorite genres is a collection of generes that the user likes, for each genre, a number from 1 to 5 representing how much the user like the genre. Nore that not all genres are neccessary in this collection.
- This is a console application, so the user interacts using a menu
- Present a menu with list of possible user actions
- The user enters a number of action to perform
- According to the selected action - he gets follow up questions
- Create the main interface loop - where you present a menu and then get a user input of the action to perform
- Action One - allow the user to state his favorite genres
- The user selects the genre
- The user selects a number from 1 - 5 representing how much he likes the genre
- Action Two - present the user information
- Presents the user info as json
- Action Three - get list of suggested show
- The score for each show, is calculated by matching the genres of the show with the user favorite genres, and summing the scores of each such genre for that user
For example, if the user marked: {Drama: 1, Comedy: 5, Action: 3}, and one show has the genres [Drama, Comedy, True Story], then the score of that show for that user is Drama (1) + Comedy (5) = 6 2. Find the 3 shows with the highest score for that user, and present them