A complete RESTful Movie Store API built with Node.js, Express, and MongoDB (Mongoose). This API allows clients to perform CRUD operations and advanced queries such as filtering, searching, sorting, and pagination on movie data.
- Create, Read, Update, Delete (CRUD) for movies
- Search movies by title
- Filter movies by:
- Title
- Rating
- Sort results by any field
- Pagination support (
pageandlimit) - RESTful API structure
- Node.js
- Express.js
- MongoDB
- Mongoose
movie-store-api/
│
├── models/
│ └── Movie.js
│
├── routes/
│ └── movies.js
│
├── controllers/
│ └── movieController.js
│
├── config/
│ └── db.js
│
├── .env
├── server.js
└── package.json
- Clone the repository
git clone https://github.com/your-username/movie-store-api.git
cd movie-store-api- Install dependencies
npm install- Setup environment variables
Create a .env file in the root with:
PORT=5000
MONGO_URI=your_mongodb_connection_string- Run the server
npm run dev| Method | Endpoint | Description |
|---|---|---|
| GET | /movies |
Get all movies (with filters) |
| GET | /movies/:id |
Get movie by ID |
| POST | /movies |
Add a new movie |
| PUT | /movies/:id |
Update a movie |
| DELETE | /movies/:id |
Delete a movie |
q: search by movie title (e.g.?q=dho)title: exact match by titlerating: filter by ratingsortBy: sort by field (e.g.?sortBy=rating)page: page number for paginationlimit: number of results per page
GET /movies?q=dho&rating=8&sortBy=title&page=1&limit=10- Authentication with JWT
- Genre/category support
- User ratings and reviews
- Upload poster image
MIT © [Niket_sahu]