xyz-cart-with-go Project
This is the basic flow of this project

# You can start the project with below commands
docker-compose up -d
go run main.go
SIGNUP FUNCTION API CALL (POST REQUEST)
For the middleware you have to set a valid token
http://localhost:8080/users/signup
{
"firstName": "Ashraful",
"lastName": "Toni",
"email": "ashrafulhaquetoni@gmail.com",
"password": "demo1234",
"phone": "016000000000"
}
Response: "Successfully Signed Up!!"
LOGIN FUNCTION API CALL (POST REQUEST)
http://localhost:8080/users/login
{
"email": "ashrafulhaquetoni@gmail.com",
"password": "demo1234"
}
response will be like this
{
"_id": "65a1752e7fa5e80e1c984935",
"firstName": "Ashraful",
"lastName": "Toni",
"password": "$2a$14$wOA.Vpxvyo5hOUt7WpAvSuNRd46NGsoKIfjnITZhxNzQKlJAUpr3m",
"email": "ashrafulhaquetoni@gmail.com",
"phone": "016000000000",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJFbWFpbCI6ImFzaHJhZnVsaGFxdWV0b25pQGdtYWlsLmNvbSIsIkZpcnN0TmFtZSI6IkFzaHJhZnVsIiwiTGFzdE5hbWUiOiJUb25pIiwiVWlkIjoiNjVhMTc1MmU3ZmE1ZTgwZTFjOTg0OTM1IiwiZXhwIjoxNzA1MTY2NTEwfQ.a40BjNjgAFoj3hUEtTkFhTkZeD5oieHnzJNyFNYXo-k",
"refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJFbWFpbCI6IiIsIkZpcnN0TmFtZSI6IiIsIkxhc3ROYW1lIjoiIiwiVWlkIjoiIiwiZXhwIjoxNzA1Njg0OTEwfQ.e-dGlvde0vwYu6Ck94q14i01tNongLAI2OxcjcxV0rM",
"created_at": "2024-01-12T17:21:50Z",
"updated_at": "2024-01-12T17:21:50Z",
"user_id": "65a1752e7fa5e80e1c984935",
"user_cart": [],
"address_details": [],
"order_status": []
}
Admin add Product Function (POST REQUEST)
http://localhost:8080/admin/addproduct
{
"product_name": "gowatch v1",
"price": 12000,
"rating": 5,
"image": "gowatch.jpg"
}
Response : "Successfully added our Product Admin!!"
View all the Products in db GET REQUEST
http://localhost:8080/users/productview
Response
[
{
"_id": "65a177127fa5e80e1c98493a",
"product_name": "gowatch v1",
"price": 12000,
"rating": 5,
"image": "gowatch.jpg"
},
{
"_id": "65a177a67fa5e80e1c98493d",
"product_name": "gomobile v1",
"price": 10000,
"rating": 4,
"image": "gomobile.jpg"
}
]
Search Product by regex function (GET REQUEST)
defines the word search sorting
http://localhost:8080/users/search?name=go
response:
[
{
"_id": "65a177127fa5e80e1c98493a",
"product_name": "gowatch v1",
"price": 12000,
"rating": 5,
"image": "gowatch.jpg"
},
{
"_id": "65a177a67fa5e80e1c98493d",
"product_name": "gomobile v1",
"price": 10000,
"rating": 4,
"image": "gomobile.jpg"
}
]
{
"house_name": "white house",
"street_name": "white street",
"city_name": "washington",
"pin_code": "332423432"
}