4. Cricket Team
Given two files
https://file.io/CY1ew0PoEZ8w
Write APIs to perform operations on the table
Columns | Type |
---|---|
player_id | INTEGER |
player_name | TEXT |
jersey_number | INTEGER |
role | TEXT |
API 1
Path: /players/
Method: GET
Description:
Returns a list of all players in the team
Response
API 2
Path: /players/
Method: POST
Description:
Creates a new player in the team (database).
Request
Response
API 3
Path: /players/:playerId/
Method: GET
Description:
Returns a player based on a player ID
Response
API 4
Path: /players/:playerId/
Method: PUT
Description:
Updates the details of a player in the team (database) based on the player ID
Request
Response
API 5
Path: /players/:playerId/
Method: DELETE
Description:
Deletes a player from the team (database) based on the player ID
Response
Use
Export the express instance using the default export syntax.
Use Common JS module syntax.
5. Movies
Given two files
and a database file
consisting of two tables
and
.
Write APIs to perform CRUD operations on the tables
,
containing the following columns,
Movie Table
Columns | Type |
---|---|
movie_id | INTEGER |
director_id | INTEGER |
movie_name | TEXT |
lead_actor | TEXT |
Director Table
Columns | Type |
---|---|
director_id | INTEGER |
director_name | TEXT |
API 1
Path: /movies/
Method: GET
Description:
Returns a list of all movie names in the movie table
Response
API 2
Path: /movies/
Method: POST
Description:
Creates a new movie in the movie table.
is auto-incremented
Request
Response
API 3
Path: /movies/:movieId/
Method: GET
Description:
Returns a movie based on the movie ID
Response
API 4
Path: /movies/:movieId/
Method: PUT
Description:
Updates the details of a movie in the movie table based on the movie ID
Request
Response
API 5
Path: /movies/:movieId/
Method: DELETE
Description:
Deletes a movie from the movie table based on the movie ID
Response
API 6
Path: /directors/
Method: GET
Description:
Returns a list of all directors in the director table
Database
Response
API 7
Path: /directors/:directorId/movies/
Method: GET
Description:
Returns a list of all movie names directed by a specific director
Response
Use
to install the packages.
Export the express instance using the default export syntax.
Use Common JS module syntax.
6. Covid-19 India
Given two files
and a database file
consisting of two tables
and
.
Write APIs to perform CRUD operations on the tables
,
containing the following columns,
State Table
Columns | Type |
---|---|
state_id | INTEGER |
state_name | TEXT |
population | INTEGER |
District Table
Columns | Type |
---|---|
district_id | INTEGER |
district_name | TEXT |
state_id | INTEGER |
cases | INTEGER |
cured | INTEGER |
active | INTEGER |
deaths | INTEGER |
API 1
Path: /states/
Method: GET
Description:
Returns a list of all states in the state table
Response
API 2
Path: /states/:stateId/
Method: GET
Description:
Returns a state based on the state ID
Response
API 3
Path: /districts/
Method: POST
Description:
Create a district in the district table,
is auto-incremented
Request
Response
API 4
Path: /districts/:districtId/
Method: GET
Description:
Returns a district based on the district ID
Response
API 5
Path: /districts/:districtId/
Method: DELETE
Description:
Deletes a district from the district table based on the district ID
Response
API 6
Path: /districts/:districtId/
Method: PUT
Description:
Updates the details of a specific district based on the district ID
Request
Response
API 7
Path: /states/:stateId/stats/
Method: GET
Description:
Returns the statistics of total cases, cured, active, deaths of a specific state based on state ID
Response
API 8
Path: /districts/:districtId/details/
Method: GET
Description:
Returns an object containing the state name of a district based on the district ID
Response
Use
to install the packages.
Export the express instance using the default export syntax.
Use Common JS module syntax.
7. Player Match Scores
Given two files
https://file.io/Z4vOLsdCDnxs
and a database file
consisting of three tables
,
and
.
Write APIs to perform operations on the tables
,
and
containing the following columns,
Player Details Table
Column | Type |
---|---|
player_id | INTEGER |
player_name | TEXT |
Match Details Table
Column | Type |
---|---|
match_id | INTEGER |
match | TEXT |
year | INTEGER |
Player Match Score Table
Column | Type |
---|---|
player_match_id | INTEGER |
player_id | INTEGER |
match_id | INTEGER |
score | INTEGER |
fours | INTEGER |
sixes | INTEGER |
API 1
Path: /players/
Method: GET
Description:
Returns a list of all the players in the player table
Response
API 2
Path: /players/:playerId/
Method: GET
Description:
Returns a specific player based on the player ID
Response
API 3
Path: /players/:playerId/
Method: PUT
Description:
Updates the details of a specific player based on the player ID
Request
Response
API 4
Path: /matches/:matchId/
Method: GET
Description:
Returns the match details of a specific match
Response
API 5
Path: /players/:playerId/matches
Method: GET
Description:
Returns a list of all the matches of a player
Response
API 6
Path: /matches/:matchId/players
Method: GET
Description:
Returns a list of players of a specific match
Response
API 7
Path: /players/:playerId/playerScores
Method: GET
Description:
Returns the statistics of the total score, fours, sixes of a specific player based on the player ID
Response
Use
to install the packages.
Export the express instance using the default export syntax.
Use Common JS module syntax.
0000000000000000000000