The backend of the e-commerce application is built using Go, Gin, and MongoDB. Go is a powerful programming language known for its simplicity and efficiency, making it an excellent choice for building robust web applications. Gin is a lightweight web framework for Go that provides a simple and intuitive API for creating RESTful APIs. MongoDB, a popular NoSQL database, is used for storing and managing the application's data. With MongoDB, you can benefit from its flexibility and scalability, making it a suitable choice for an e-commerce application that may handle a large volume of data. The backend project is organized into different components, such as routes, controllers, and models, following best practices for structuring a Go web application. By leveraging the power of Go, Gin, and MongoDB, the backend provides a reliable and efficient foundation for the e-commerce application.
To get started, clone the repository and navigate to the project directory.
git clone
cd backend
go mod download
go run main.go
The project is organized into different components, such as routes, controllers, and models, following best practices for structuring a Go web application.
├── controllers
│ ├── products.go
│ └── users.go
├── database
│ └── database.go
├── middlewares
│ └── auth.go (JWT authentication)
├── models
│ ├── product.go
│ └── user.go
├── routes
│ ├── products.go
│ └── users.go
├── utils
│ ├── error.go
│ └── response.go
├── .gitignore
├── go.mod
├── go.sum
├── main.go
└── README.md
https://documenter.getpostman.com/view/21427214/2s93sc4sWv
The backend provides the following API endpoints for managing the application's data.
GET /products
- Get all productsGET /products/:id
- Get a single productGET /products/page?page?=1&pageSize=2
- Get products with pagination
POST /users/register
- Register a new userPOST /users/login
- Login an existing userGET /users/profile
- Get user profile