Skip to content

ice-solution/kapo_backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Client Profile API

這是一個用於管理客戶檔案的 API,支持用戶的身份驗證、客戶檔案的創建、更新、刪除和查詢功能。

目錄

技術棧

  • Node.js
  • Express
  • MongoDB
  • Mongoose
  • dotenv
  • bcrypt
  • express-session
  • connect-mongo

安裝

  1. 克隆此存儲庫:

    git clone https://github.com/yourusername/client-profile-api.git
    cd client-profile-api
  2. 安裝依賴:

    npm install
  3. 創建 .env 文件並設置環境變數:

    MONGODB_URI=mongodb+srv://username:password@cluster0.kelsrqo.mongodb.net/fingerprint
    PORT=4488
    

環境變數

  • MONGODB_URI: MongoDB 的連接字符串。
  • PORT: 伺服器運行的端口(默認為 4488)。

API 端點

用戶相關

  • 註冊用戶

    • 方法: POST
    • 路徑: /api/users
    • 請求體:
      {
          "name":"keith",
          "gender":"M",
          "birth":"1991-03-11",
          "phone":"24455666",
          "email":"keith@gmail.com",
          "password":"user_password"
      }
  • 登入用戶

    • 方法: POST
    • 路徑: /api/users/login
    • 請求體:
      {
          "email": "your_email",
          "password": "your_password"
      }

客戶檔案相關

  • 創建客戶檔案

    • 方法: POST
    • 路徑: /api/clientProfiles
    • 請求體:
      {
          "name": "John Doe",
          "gender": "male",
          "birth": "1990-01-01",
          "age": 33,
          "dropdownSelection": "option1",
          "fingerprints": [
              {
                  "hand": "right",
                  "img": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA...",
                  "ring": 1,
                  "fingerType": "loop"
              }
          ]
      }
  • 獲取用戶的所有客戶檔案

    • 方法: GET
    • 路徑: /api/clientProfiles/user
    • 請求參數: 無需參數,通過 session 獲取用戶 ID。
  • 更新客戶檔案

    • 方法: PUT
    • 路徑: /api/clientProfiles/:id
    • 請求體:
      {
          "name": "Updated Name",
          "gender": "female",
          "age": 34
      }
  • 刪除客戶檔案

    • 方法: DELETE
    • 路徑: /api/clientProfiles/:id
    • 請求參數: 無需參數,通過 session 獲取用戶 ID。

使用說明

  1. 啟動伺服器:

    npm start
  2. 使用 Postman 或其他 API 測試工具來測試 API 端點。

貢獻

歡迎任何形式的貢獻!請提交問題或拉取請求。

許可證

此項目使用 MIT 許可證。詳情請參見 LICENSE 文件。

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published