- Docker v23
- Node v16.19.1 (through nvm)
Create and run dev database:
docker run -d \
-e POSTGRES_DB=movieDB \
-e POSTGRES_USER=irfan \
-e POSTGRES_PASSWORD=123456 \
-p 5434:5432 postgres
Create and run test database:
docker run -d \
-e POSTGRES_DB=testDB \
-e POSTGRES_USER=irfan \
-e POSTGRES_PASSWORD=123456 \
-p 5435:5432 postgres
The backend resides in the server
directory and the frontend resides in the client
directory.
For backend:
cd server
npm i
npm run dev
For frontend:
cd client
npm i
npm run dev
To run the test suites:
cd server
npm test
GET /movie
fetch all moviesGET /movie/:title
fetch movie with the giventitle
POST /movie
create a new movie. Required fields are:title
,plan
,rentPeriod
,rentPrice
. Optional fields are:releaseYear
,posterUrl
, andtags
.tags
should be an array of strings.PUT /movie/:id
update movie details with givenid
DELETE /movie/:id
delete the movie with givenid
.
GET /cast
fetch all castsGET /cast/:name
fetch cast with the givenname
POST /cast
create a new cast. The required field is:name
PUT /cast/:id
update cast details with givenid
DELETE /cast/:id
delete the cast with givenid
.
GET /user
fetch all users data.GET /user/:id
fetch user with the givenid
.POST /user
create a new user. Required fields:name
,email
,password
,plan
PUT /user/:id
update the user with the givenid
.DELETE /user/:id
delete the user with the givenid
.
GET /fetch?t=[title]
fetch data from OMDb with giventitle
GET /fetch?i=[imdbId]
fetch data from OMDb with givenimdbId
GET /catalogue
fetch all movies in the catalogue along with cast information.GET /basic
fetch all movies available in the basic plan.GET /premium
fetch all movies available in the premium plan.POST /catalogue
add a movie to catalogue. Required fields:movie
,casts
.movie
should contain required fields:title
,plan
,rentPeriod
,rentPrice
.casts
should be an array of cast names.
POST /auth/register
register a user. Required fields:name
,email
,password
,plan
.POST /auth/login
login a user. Required fields:email
,password
GET /rent
fetch all rent data.GET /rent/status
check rent status for a movie and a user. Required query parameters:userId
andmovieId
GET /rent/user/:id
fetch all rent data of the user with idid
.GET /rent/movie/:id
fetch all rent data of the movie with idid
.POST /rent
create a rent. Required fields:userId
,movieId
,rentPeriod
,rentPrice
.PUT /rent
update a rent. Required fields:userId
andmovieId
.DELETE /rent
delete a rent. Required fields:userId
andmovieId
.