Skip to content

Subham-bits/CRUD-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

I'd be glad to help you create a comprehensive README file for your Node.js Express and MongoDB project, incorporating the best aspects of the provided responses and addressing any identified issues:

README.md

Project Title: Node.js Express and MongoDB CRUD API

Description:

This is a simple backend RESTful API built using Node.js, Express, and MongoDB. It allows you to perform Create, Read, Update, and Delete (CRUD) operations on product data.

Features:

  • Product Management:
    • Add new products with name, quantity, and price.
    • Retrieve a list of all products.
    • Get details of a specific product by ID.
    • Update existing product information.
    • Delete products.
  • Error Handling:
    • Provides informative error messages for invalid requests or database issues.

Prerequisites:

  • Node.js and npm (or yarn) installed on your system.
  • A MongoDB database instance running.

Installation:

  1. Clone the project repository:

    git clone https://github.com/your-username/your-project-name.git
  2. Install dependencies:

    cd your-project-name
    npm install

Configuration:

  • Create a .env file in the project root and add the following environment variables:

    MONGODB_URI=your_mongodb_connection_string
    

Usage:

  1. Start the server:

    node index.js
  2. Access the API endpoints using your preferred HTTP client (e.g., Postman, curl).

Endpoints:

  • GET /products: Retrieve a list of all products.
  • GET /products/:id: Retrieve details of a specific product by ID.
  • POST /products: Add a new product.
  • PUT /products/:id: Update an existing product.
  • DELETE /products/:id: Delete a product.

Example Usage:

# Add a new product
curl -X POST http://localhost:3000/products -H "Content-Type: application/json" -d '{
  "name": "Product 1",
  "quantity": 10,
  "price": 9.99
}'

# Get all products
curl http://localhost:3000/products

Contributing:

Contributions are welcome! Please feel free to fork the project, make changes, and submit a pull request.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published