This project is a backend service for a single-page product creation about sport related application. It provides a robust API for managing products, including creation, retrieval, updating, and deletion operations. The backend also features a custom query builder for flexible data retrieval.
- Create Product: Add new products to the database with details such as name, price, description, etc.
 - Get Product: Retrieve product information, including support for fetching single products or lists of products.
 - Update Product: Modify existing product details.
 - Delete Product: Remove products from the database.
 - Custom Query Builder: Flexible querying system for advanced product searches and filtering.
 
- Node.js
 - Express.js
 - MongoDB
 - TypeScript
 
- 
Clone the repository:
git clone https://github.com/minhaz1010/Sporthub-Server.git - 
Install dependencies:
npm install - 
Set up environment variables: Create a
.envfile in the root directory and add the following:MONGODB_URI=Your_Database_URL - 
Start the server:
npm run startor for development:
npm run dev 
POST /api/products: Create a new productGET /api/products: Get all productsGET /api/products/:id: Get a single product by IDPATCH /api/products/:id: Update a productDELETE /api/products/:id: Delete a product
##Query Builder
The custom query builder allows for flexible searching and filtering of products. You can use it by sending GET requests to /api/products with query parameters.
Example:
GET /api/v1/products?searchTerm=badminton&sort=-stock&limit=5&fields=name,brand,stock&page=2
Retrieves badminton-related products, sorted by stock (descending), limited to 5 results per page, showing only name, brand, and stock fields, and returns the second page of results.