This API is built with Express and uses MongoDB as the database. It provides functionality for user authentication, movie listings, and movie rentals.
- Node.js: ^12.0.0
Install packages npm:
npm install
Start the dev server with this command:
npm run dev
Run http://localhost:3000/ in your borwser to do the tests.
Start the production server with this command:
npm start
This API has the following endpoints:
- POST
/auth/register: This endpoint is used to register a new user. It requires the following parameters in the request body:email,password,name. - POST
/auth/login: This endpoint is used to login a user. It requires the following parameters in the request body:email,password.
- GET
/movie: This endpoint is used to get all movies. - GET
/movie/:id: This endpoint is used to get a movie by id.
- PATCH
/users/users/:userId/rent: This endpoint is used to update rented movies. - PATCH
/users/users/:userId/delete/:movieId: This endpoint is used to delete a rented movie by id.
- GET
/users: This endpoint is used to get all users. Only superadmin users can access this endpoint. - GET
/users/users/:name: This endpoint is used to get a user by name. - POST
/users/delete/:id: This endpoint is used to delete a user by id.