###### tags: `教學` # Backend ---- ## 前後端分離 ---- ### 前端 : 負責user看得到的部份 ### 後端 : 負責user看不到的部份 ---- - 為前端提供資料 - 資料庫 - 底層業務邏輯實現 - API實做 - ... --- ## API **application programming interface** AKA 前端與後端溝通的管道 ---- API : 服務生 Backend : 廚房 ---- server會監聽來自 **http://localhost:3000** ( 以這個project為例 )的http request,並做出對應的回應 ---- 使用http method送出http request ---- ## RESTful API - Get : 查找 - Post : 新增 - Patch : 更新 - Delete : 刪除 ---- http method : 動作 url : 目標 ---- ``` Get http://localhost:3000/helloWord ``` --- ## 實做環節 ---- git@github.com:Iittlefish/spyDog-Backend.git https://github.com/Iittlefish/spyDog-Backend.git ---- 1. 接收來自client端的request 2. 根據不同的request呼叫、執行不同的method 3. 回傳資料 ---- ![](https://i.imgur.com/cf1yaCm.png) ---- - express : 框架、骨幹
{"metaMigratedAt":"2023-06-16T23:52:10.904Z","metaMigratedFrom":"Content","title":"Backend","breaks":true,"contributors":"[{\"id\":\"971231c6-4fae-44ed-bc28-ee6c9447cc81\",\"add\":845,\"del\":77}]"}
    82 views