This is a simple API for a mobile store. It uses Express.js and MongoDB.
- Fetch all mobiles
- Add multiple mobiles at once
- Fetch a specific mobile by ID
- Search for mobiles by name, type, processor, OS
- Add a mobile to the cart
- Remove a mobile from the cart
- Fetch all items in the cart
- Clone the repository
git clone https://github.com/Ayush-Vish/mobileStore-api.git
- Change the directory
cd mobileStore-api
- Install dependencies with
npm install
- Create a
.env
file in the root directory and add your MongoDB URI and client URL like this: - Run the server with npm run dev
MONGO_URI=your_mongodb_uri
CLIENT_URL=your_client_url
PORT=3000
GET /api/mobiles: Fetch all mobiles POST /api/mobiles/bulk: Add multiple mobiles at once GET /api/mobiles/:id: Fetch a specific mobile by ID GET /search: Search for mobiles by name, type, processor, OS GET /api/cart: Fetch all items in the cart POST /api/cart: Add a mobile to the cart DELETE /api/cart/:id: Remove a mobile from the cart