Coder Social home page Coder Social logo

dataworker2001 / e-commerce-api Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 97 KB

Easy to Use, user-friendly and Handy E-Commerce API

Home Page: https://crowded-mite-galoshes.cyclic.app/

License: GNU General Public License v3.0

JavaScript 100.00%
api-calls backend backend-api csv-parser cyclic database-server delete deployed express get json mongodb mongoose node non-relational-database nosql post put schema server

e-commerce-api's Introduction

Ecommerce Inventory Management API

Contributed By: Arpan Choudhury

image

This project implements an API for an ecommerce platform admin to manage product inventory using Node.js and MongoDB. It provides endpoints to add, list, update, and delete products from the inventory.

Tech Stack:- Node.js and MongoDB

Folder Structure:-
ecommerce-api
├── models
│ └── product.js
├── controllers
│ └── productController.js
├── routes
│ └── productRoutes.js
├── config
│ └── db.js
├── server.js
└── package.json
└── package-lock.json
└── README.md
└── .gitattributes
└── .gitignore
└── Test 1 - Ecommerce API.docx

Setup:- To set up the project on your local system, follow these steps:

  1. Clone the repository:-
    $ Shell/Terminal:
    git clone https://github.com/DataWorker2001/E-COMMERCE-API.git

  2. Install dependencies:-
    $ Shell/Terminal:
    cd ecommerce-api
    npm install

  3. Configure the MongoDB connection in db.js using the dbURI variable as:
    const dbURI = 'mongodb+srv://:@cluster0.hciafyn.mongodb.net/ecom';
    after creating a db.js file in the config folder in the root directory and the rest code.

  4. Start the server:
    $ Shell/Terminal
    npm start
    The server will start running on http://localhost:3000.
    ---------------------------------------------------------------------------x-----------------------------------------------------------------------------

API Endpoints:-

i) Add a product to the database URL [POST]: /products/create

Request body:

$json:
{ "name": "laptop", "quantity": 10 } Response body:

$json:
{ "product": { "name": "laptop", "quantity": 10 } }

ii) List all products URL [GET]: /products

Response body:

$json

{ "products": [ { "id": 1, "name": "laptop", "quantity": 10 }, { "id": 2, "name": "camera", "quantity": 5 }, { "id": 3, "name": "smartwatch", "quantity": 8 } ] } iii) Delete a product URL [DELETE]: /products/:id

Response body:

$json:
{ "message": "product deleted" }

iv) Update quantity of a product URL [POST]: /products/:id/update_quantity/?number=10

Response body:

$json:
{ "product": { "id": 1, "name": "laptop", "quantity": 20 }, "message": "updated successfully" }

This README provides an overview of the project, setup instructions, and details about the available API endpoints.

Good luck with this project! If you find any problems in the code, feel free to start the forking of this repo. and using pull requests.

e-commerce-api's People

Contributors

dataworker2001 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.