Skip to content

yusufstawan/marketplace-api-express-typescript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Final Project Yusuf Setiyawan BE 58

Tech Stack

  • Express
  • Typescript
  • Yup
  • MongoDB
  • Mongoose
  • Multer
  • Cloudinary
  • JWT
  • Nodemailer
  • EJS

URL Deploy

https://sanber-be-58-final-project-yusuf-production.up.railway.app/

Endpoints Documentation

Base URL

https://sanber-be-58-final-project-yusuf-production.up.railway.app/api

Request Headers

Authorization: Bearer <your-jwt-token>

Health check

1. Create Order

  • Endpoint: /
  • Method: GET
  • Request Body:

Auth

1. Register

  • Endpoint: /auth/register
  • Method: POST
  • Request Body:
{
  "email": "yusuf.dev.2024@gmail.com",
  "fullName": "Yusuf Dev",
  "password": "12341234",
  "username": "yusuf.dev",
  "roles": ["admin"]
}
  • Email receipt register

2. Login

  • Endpoint: /auth/login
  • Method: POST
  • Request Body:
{
  "email": "yusuf.dev.2024@gmail.com",
  "password": "12341234"
}

3. Get Profile

  • Endpoint: /auth/me
  • Method: GET
  • Request Headers:
    • Authorization: Bearer <your-jwt-token>

4. Update Profile

  • Endpoint: /auth/profile
  • Method: PUT
  • Request Headers:
    • Authorization: Bearer <your-jwt-token>
  • Request Body:
{
    "fullName":  "Update Yusuf",
    "password": "admin123"
}

Products

1. Get All Products

  • Endpoint: /products
  • Method: GET

2. Create Product

  • Endpoint: /products
  • Method: POST
  • Request Body:
{
    "name": "Kemeja dengan Kategori",
    "description": "Deskripsi kemeja dengan kategori",
    "images": ["https://res.cloudinary.com/five-code/image/upload/v1718805645/fxuurm45mt5talry7a29.png", "sepatu2.jpg", "sepatu3.jpg"],
    "price": 15000,
    "qty": 100,
    "category": "66a260cd6ceb26325b62fcef"
}

3. Get Product by ID

  • Endpoint: /products/:id
  • Method: GET
  • URL Parameters:
    • id (required): The ID of the product.

4. Update Product

  • Endpoint: /products/:id
  • Method: PUT
  • URL Parameters:
    • id (required): The ID of the product.
  • Request Body:
{
    "name": "Update"
}

5. Delete Product

  • Endpoint: /products/:id
  • Method: DELETE
  • URL Parameters:
    • id (required): The ID of the product.

Categories

1. Get All Categories

  • Endpoint: /categories
  • Method: GET

2. Create Categories

  • Endpoint: /categories
  • Method: POST
  • Request Body:
{
"name":  "Test"
}

3. Get Categories by ID

  • Endpoint: /categories/:id
  • Method: GET
  • URL Parameters:
    • id (required)

4. Update Categories

  • Endpoint: /categories/:id
  • Method: PUT
  • URL Parameters:
    • id (required)
  • Request Body:
{
"name":  "update"
}

5. Delete Categories

  • Endpoint: /categories/:id
  • Method: DELETE
  • URL Parameters:
    • id (required)

Media Upload

1. Post Single File

  • Endpoint: /upload
  • Method: POST
  • Request Body: Form Data
{
  "file": "image.png"
}

2. Post Multiple Files

  • Endpoint: /uploads
  • Method: POST
  • Request Body: Form Data
{
  "files": "image1.png",
  "files": "image2.png"
}

Order

1. Create Order

  • Endpoint: /orders
  • Method: POST
  • Request Body:
{
  "grandTotal": 289000,
  "orderItems": [
    {
      "productId": "66a89e3fccb68bdd5ff7603b",
      "quantity": 1
    }
  ],
   "status": "pending"
}
  • Email receipt order

2. List Order

  • Endpoint: /orders
  • Method: GET

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •