This Node.js application uses MongoDB with Mongoose to manage product data through a RESTful API. It supports CRUD operations for product management.
- Node.js: Install from nodejs.org.
- npm: Included with Node.js.
- MongoDB: Install locally or use MongoDB Atlas.
-
Clone the repository:
git clone https://github.com/jethcherry/NodeMongodb.git cd NodeMongodb -
Install dependencies:
npm install
Create a .env file in the root directory with:
MONGO_URI=your_mongodb_connection_string
3.## API Endpoints
GET /api/products: Retrieve all products.
GET /api/products/:id: Retrieve a product by ID.
POST /api/products: Create a new product.
PUT /api/products/:id: Update a product by ID.
DELETE /api/products/:id: Delete a product by ID
## Testing
You can test the API endpoints using the following tools:
## REST Client (VS Code Extension)
## THUNDER CLIENT (VS Code Extension)
## POST MAN (DOWNLOAD AS A SOFTWARE
## INSOMNIA (DOWNLOAD AS A SOFTWARE)