Skip to content
This repository has been archived by the owner on Jul 15, 2021. It is now read-only.

whchi/too-young-too-naive

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

這個邊只是拿來練習REST API的設計,使用方式寫在各ws裡面 ###設計概念 只透過POST來執行,因此相對應的文件需要很明確指出用法

  • WS路徑

http://hostname/{module}/{action},翻譯成此程式碼就是http://hostname/articles/add_an_article

  • API設計概念

大致上分為3層(可用MVC的觀念來看)

  1. **[view]**最外層的接收端,只進行接收與回傳json
  2. **[controller]**檢查傳入變數是否有問題,並處理回傳訊息
    • 參數錯誤的訊息在這層處理
  3. **[model]**執行對應的WS動作(實際呼叫DB連線的class,只處理對資料庫的CRUD並回傳結果)
    • 資料庫連線錯誤的訊息在這層處理

備註:

  • 與DB連線那段是用PDO實作,如果沒有PDO模組請安裝
  • 兩份sql檔案都要安裝,因為有綁定外部索引
  • db_lib中有debuglog這段尚未實作
  • 使用POSTMAN測試

About

只是暫存

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages