This is a FullStack project of a complete E-Commerce APP. Pitchau was inspired in the tech store of Pichau!
Pithcau E-Commerce was made for the fourteenth project of Driven Full Stack Web Development bootcamp. And it was made by two amazing developers who loves technology and games!
- Log in
- Sign up
- Authentication routes for registering and logging in
- You can see all products in the store
- You can filter for categories in the navigation bar
- You can add and remove products to your cart
- See what products are in your cart
- Checkout page
- Number of products in your cart shows dinamically in the top cart icon
- Finish buy using just a fake card
- Insert new products (Authenticated Router)
- Get products (Authenticated Router)
- Sign In and Sign Up route
- Add, remove products to your cart
- Checkout route
- Clone the project
git clone https://github.com/vinicbarros/Pitchau-Back.git
- Go to the project directory
cd Pitchau-Back
- Install dependencies
npm install
- Go to src directory
cd src
-
Before running server, make sure that MongoDB is running in your machine and a db called "pitchau" is created
-
Start the server
npm run dev
POST /sign-up
Body:
{
"name": "Pedro",
"email": "pedro@gmail.com",
"password": "secret"
}
Response:
- Invalid Body
"status": 400
- Email is already in use
"status": 409
- Account is created
"status": 201
POST /sign-in
Body:
{
"email": "pedro@gmail.com",
"password": "secret"
}
Response:
- Invalid Body
"status": 400
- Email and password do not match
"status": 404
- User is logged in
"status": 202
Response Body:
{
"user": {
"id": 1,
"name": "Pedro",
"email": "pedro@gmail.com"
},
"token": "token"
}
Instead of "token", use your own token acquired through the /sign-in route
{
"headers": {
"Authorization": "Bearer token"
}
}
POST /products
Body:
{
"nameProduct": "Headset Gamer With LED",
"img": "https://image.png",
"category": "Headset",
"description": "Best headset",
"price": 10099
}
Response:
- Invalid Body
"status": 400
- Product is created
"status": 201
GET /products
Response:
{
"products": [
{
"_id": "1",
"nameProduct": "Notebook gamer",
"img": "https://notebookimage.png",
"category": "Notebook",
"description": "The best notebook ever!",
"price": 128099
}
]
}
GET /products?category={category}
Parâmetro | Tipo | Descrição |
---|---|---|
category |
string |
Needs to be a valid category |
Response:
{
"products": [
{
"_id": "1",
"nameProduct": "Notebook gamer",
"img": "https://notebookimage.png",
"category": "Notebook",
"description": "The best notebook ever!",
"price": 128099
}
]
}
POST /checkout
Body:
{
"method": "Credit",
"payment": "",
"numberCard": 123456789,
"cvv": 123,
"products": []
}
Response:
- Invalid Body
"status": 404
- Buy completed
"status": 200
POST /cart
Body:
{
"productId": 12
}
Response:
- Invalid Body
"status": 401
- Product added
"status": 201
GET /cart
Response:
- Invalid Body
"status": 401
- Status OK
{
"userCartList": [
{
"_id": "1",
"userId": "1",
"productId": "2",
"name": "Monitor ",
"img": "https://monitor.jpg",
"description": "The best!",
"price": 72999
}
]
}
DELETE /cart/:id
Parâmetro | Tipo | Descrição |
---|---|---|
id |
string |
Needs to be a valid id |
Response:
- Invalid Params
"status": 404
- Item deleted
"status": 200
Feel free to contact me in Linkedin!