Skip to content

This project is a scalable and efficient backend for an e-commerce platform, written in Go.

Notifications You must be signed in to change notification settings

jash707/ecommerce-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ecommerce-Backend

Overview

This repository contains the backend code for an e-commerce application, including user authentication, product management, cart functionality, and more. The APIs are documented below, covering various aspects of the system, such as cart management, address handling, and user authentication.

Prerequisites

Before you start, ensure you have the following installed on your machine:

Installation

  1. Clone the repository:

    git clone https://github.com/jash707/ecommerce-go.git
  2. Navigate to the project directory:

    cd ecommerce-go
  3. Install the required Go modules:

    go mod tidy
  4. Run the application:

    go run main.go
  5. The server will start on https://localhost:8000.

API Documentation

1. Cart Management

  • Add to Cart

    GET /addtocart?productID=<productID>&userID=<userID>

    Headers:

    • token: JWT token for authentication
  • Remove from Cart

    GET /removeitem?productID=<productID>&userID=<userID>

    Headers:

    • token: JWT token for authentication
  • List Cart Items

    GET /listcart?userID=<userID>

    Headers:

    • token: JWT token for authentication
  • Checkout Cart

    GET /cartcheckout?userID=<userID>

    Headers:

    • token: JWT token for authentication

Address Management

  • Add Address

    POST /addaddress?userID=<userID>

    Headers:

    • token: JWT token for authentication

    Body:

    {
      "house_name": "white house",
      "street_name": "white street",
      "city_name": "washington",
      "pin_code": "332423432"
    }

    Note: The Address array is limited to two values: Home and Work addresses.

    • The first address added will be saved as the Home address.
    • The second address added will be saved as the Work address.
    • Adding more than two addresses is not acceptable.
  • Edit Home Address

    PUT /edithomeaddress?userID=<userID>

    Headers:

    • token: JWT token for authentication

    Body:

    {
      "house_name": "aangan",
      "street_name": "citylight",
      "city_name": "surat",
      "pin_code": "395007"
    }
  • Edit Work Address

    PUT /editworkaddress?userID=<userID>

    Headers:

    • token: JWT token for authentication

    Body:

    {
      "house_name": "white house",
      "street_name": "white street",
      "city_name": "washington",
      "pin_code": "332423432"
    }
  • Delete Addresses

    PUT /deleteaddresses?userID=<userID>

    Headers:

    • token: JWT token for authentication

3. User Management

  • Sign Up

    POST /users/signup

    Body:

    {
      "first_name": "Tony",
      "last_name": "Stark",
      "email": "[email protected]",
      "password": "tony1234",
      "phone": "+918569745600"
    }
  • Login

    POST /users/login

    Body:

    {
      "email": "[email protected]",
      "password": "tony1234"
    }

4. Product Management

  • Add Product

    POST /admin/addproduct

    Body:

    {
      "product_name": "Hp pavillion",
      "price": 4500,
      "rating": 7,
      "image": "hp.jpg"
    }
  • View Products

    GET /users/productview
  • Search Product by Query

    GET /users/search?name=<query>

About

This project is a scalable and efficient backend for an e-commerce platform, written in Go.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages