GithubHelp home page GithubHelp logo

yashmaroo / crudecommerce Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 32 KB

Node js CRUD functionality for eCommerce apps

Home Page: https://shielded-woodland-89278.herokuapp.com/

JavaScript 100.00%

crudecommerce's Introduction

CRUD Operations for eCommerce applications

CRUD for products with details

GET PRODUCTS LIST

Route : '/' Response returned

{
    "products": [
        {
            "_id": "611e3870beb79c5023e542ec",
            "sellerId": "1",
            "name": "USB Converter",
            "imageUrl": "https://picsum.photos/200",
            "description": "B to C type converter",
            "price": 999,
            "__v": 0
        },
        {
            "_id": "611e4089d147d258518367ac",
            "sellerId": "1",
            "name": "Test Product 2",
            "imageUrl": "https://picsum.photos/200",
            "description": "Awesome Product",
            "price": 100,
            "__v": 0
        },
    ]
}

GET INDIVIDUAL PRODUCTS

Route : '/products/:id'

:id is the parameter for the id of the product to be found

Response returned

{
    "products": [
        {
            "_id": "611e3870beb79c5023e542ec",
            "sellerId": "1",
            "name": "USB Converter",
            "imageUrl": "https://picsum.photos/200",
            "description": "B to C type converter",
            "price": 999,
            "__v": 0
        },
    ]
}

Add a new product

Route : '/new_product'

req.body =

{
    "sellerId": "4",
    "name": "Gibberish",
    "imageUrl": "https://picsum.photos/200",
    "description": "Lorem Ipsum",
    "price": 4000
}

Response returned

{
    "message": "Product added successfully",
    "product": {
        "_id": "611f598bccdb5db2ec7be997",
        "sellerId": "4",
        "name": "Phone Cover",
        "imageUrl": "https://picsum.photos/200",
        "description": "Neon Cover",
        "price": 400,
        "__v": 0
    }
}

Edit a Product

Get the product to be edited previous details

Route: /:id/edit_product Response returned

{
    "product": {
        "_id": "611f598bccdb5db2ec7be997",
        "sellerId": "4",
        "name": "Phone Cover",
        "imageUrl": "https://picsum.photos/200",
        "description": "Neon Cover",
        "price": 400,
        "__v": 0
    }
}

Put request to edit the details

Route: /:id

req.body =

{
    "product" : {
        "sellerId": "1",
        "name": "USB Converter",
        "imageUrl": "https://picsum.photos/200",
        "description": "B to C type converter",
        "price": 899
    }
}

Response returned

{
    "message": "Product successfully updated"
}

Similarly the other routes for cart and products are made

buyer_id: Any integer for which the cart or wishlist is needed

id: Product mongoDb id

Wishlist Routes

Request Type Route Use of the Route
GET /:buyer_id/wishlist Returns the content of the wishlist for a particular buyer id
POST /wishlist/:buyer_id/add_item/:id Adding items to the wishlist
POST /wishlist/:buyer_id/delete_item/:id Deleting the product from the wishlist
POST /wishlist/:buyer_id/empty_all Empty the wishlist at a go

Cart Routes

Request Type Route Use of the Route
GET /cart/:buyer_id Returns the content of the cart for a particular buyer id
POST /cart/:buyer_id/add_item/:id Adding items to the cart or increasing the quantity for a item in a cart
POST /cart/:buyer_id/delete_item/:id Deleting the product from the cart
POST /cart/:buyer_id/delete_one/:id Deleting the instances of a product from the cart
POST /cart/:buyer_id/empty_all Empty the cart at a go

crudecommerce's People

Contributors

yashmaroo avatar

Watchers

James Cloos avatar  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.