https://github.com/pushkarm029/shopping-app-backend-go
Created Shopping App Backend using Go, Gin, GORM & Postgres which can perform CRUD operation.
https://github.com/pushkarm029/shopping-app-backend-go
api docker docker-compose go-gin go-gorm golang postgresql rest-api
Last synced: 3 months ago
JSON representation
Created Shopping App Backend using Go, Gin, GORM & Postgres which can perform CRUD operation.
- Host: GitHub
- URL: https://github.com/pushkarm029/shopping-app-backend-go
- Owner: Pushkarm029
- Created: 2023-09-06T19:27:28.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-10-17T13:42:38.000Z (almost 3 years ago)
- Last Synced: 2025-02-08T21:29:04.540Z (over 1 year ago)
- Topics: api, docker, docker-compose, go-gin, go-gorm, golang, postgresql, rest-api
- Language: Go
- Homepage:
- Size: 39.1 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## **🔥 Introduction**
This documentation provides an overview of the APIs available for a shopping app. These APIs allow users and sellers to interact with the shopping platform by performing actions such as user registration, login, product management, cart management, and order management etc.
## **💥 APIs**
```go
r.POST("/api/user/login", userauth.Login)
r.POST("/api/user/register", userauth.Register)
r.POST("/api/seller/login", sellerauth.Login)
r.POST("/api/seller/register", sellerauth.Register)
r.POST("/api/seller/addproduct", middleware.RequireSellerAuth, sellerhandler.AddProduct)
r.GET("/api/seller/getproduct", middleware.RequireSellerAuth, sellerhandler.Get_Product)
r.GET("/api/getallproducts", userhandler.Search_Product)
r.DELETE("/api/seller/delete", middleware.RequireSellerAuth, sellerhandler.RemoveProduct)
r.PUT("/api/seller/update", middleware.RequireSellerAuth, sellerhandler.Update_Product)
r.POST("/api/user/addcart", userhandler.Add_Item_In_Cart)
r.DELETE("/api/user/removecart", userhandler.Remove_Item_In_Cart)
r.GET("/api/user/viewcart", userhandler.View_Item_In_Cart)
r.POST("/api/user/placeorder", middleware.RequireUserAuth, userhandler.Place_Order)
r.DELETE("/api/user/cancelorder", middleware.RequireUserAuth, userhandler.Cancel_Order)
r.GET("/api/user/vieworder", middleware.RequireUserAuth, userhandler.View_Purchased_Items)
```
## **🛠️ Local Development** :
1. Open your terminal and then type
```shell
$ git clone https://github.com/Pushkarm029/Amazon-Shopping-Backend
```
2. cd into the folder
```shell
$ cd Amazon-Shopping-Backend/
```
3. install all go dependencies
```shell
$ go get ./...
```
4. Start Database on :5432
```shell
docker compose up
```
5. Start the server on :8080
```shell
go run main.go
```
6. Testing API's
```shell
Add postman_examples/Amazon Backend.postman_collection.json in Postman Collection
```
**Note : You need to restart backend server after every change in any .go file.**
## **❤️ Learnings** :
- Implementation of GORM.
- Basics of PostgreSQL.
- use of Postman Collections.
## **⛑️ Maintenance** :
Feel free to open issue to add a feature request or report any BUG. It will be appreciated from the depth of my heart❤️.