[{"data":1,"prerenderedAt":1020},["ShallowReactive",2],{"navigation_docs":3,"-web-dev-network-restful-api":352,"-web-dev-network-restful-api-surround":1015},[4,54,83,116,125,161,179,200],{"title":5,"path":6,"stem":7,"children":8},"Ai","/ai","ai",[9,12,42,46,50],{"title":10,"path":6,"stem":11},"AI 技術探索","ai/index",{"title":13,"path":14,"stem":15,"children":16,"page":41},"Rag","/ai/rag","ai/RAG",[17,21,25,29,33,37],{"title":18,"path":19,"stem":20},"BM25 演算法深入解析：從 TF-IDF 到現代搜尋引擎的核心技術","/ai/rag/bm25-deep-dive-from-tf-idf-to-rag","ai/RAG/bm25-deep-dive-from-tf-idf-to-rag",{"title":22,"path":23,"stem":24},"Dense Retrieval（向量檢索）深入解析","/ai/rag/dense-retrieval-deep-dive","ai/RAG/dense-retrieval-deep-dive",{"title":26,"path":27,"stem":28},"RAG（Retrieval-Augmented Generation）原理與實作入門","/ai/rag/rag-intro-principles-and-implementation","ai/RAG/rag-intro-principles-and-implementation",{"title":30,"path":31,"stem":32},"RAG Retrieval Strategy 深入解析","/ai/rag/rag-retrieval-strategy-deep-dive","ai/RAG/rag-retrieval-strategy-deep-dive",{"title":34,"path":35,"stem":36},"Reciprocal Rank Fusion（RRF）教學：打造更穩定的檢索融合策略","/ai/rag/rrf-reciprocal-rank-fusion-guide","ai/RAG/rrf-reciprocal-rank-fusion-guide",{"title":38,"path":39,"stem":40},"TF-IDF（Term Frequency–Inverse Document Frequency）深入解析","/ai/rag/tf-idf-deep-dive","ai/RAG/tf-idf-deep-dive",false,{"title":43,"path":44,"stem":45},"Docus AI 功能完整實作指南","/ai/docus-ai-implementation","ai/docus-ai-implementation",{"title":47,"path":48,"stem":49},"llms.txt 是什麼？在 Nuxt 中控制 AI 與搜尋引擎爬蟲的新方式","/ai/llms-txt","ai/llms-txt",{"title":51,"path":52,"stem":53},"MCP（Model Context Protocol）是什麼？用「AI 的 USB-C」理解模型如何安全連接工具與資料","/ai/mcp_concept","ai/mcp_concept",{"title":55,"path":56,"stem":57,"children":58,"page":41},"Data Analysis","/data-analysis","data-analysis",[59,63,67,71,75,79],{"title":60,"path":61,"stem":62},"Exploratory Data Analysis（EDA）資料探索分析入門","/data-analysis/exploratory-data-analysis-eda","data-analysis/exploratory-data-analysis-eda",{"title":64,"path":65,"stem":66},"PR-AUC 深入解析：不平衡分類問題的重要評估指標","/data-analysis/pr-auc-for-imbalanced-classification","data-analysis/pr-auc-for-imbalanced-classification",{"title":68,"path":69,"stem":70},"ROC-AUC 深入解析：理解分類模型的判斷能力","/data-analysis/roc-auc-complete-guide","data-analysis/roc-auc-complete-guide",{"title":72,"path":73,"stem":74},"SHAP（SHapley Additive exPlanations）模型解釋方法深入解析","/data-analysis/shap-model-interpretation-complete-guide","data-analysis/shap-model-interpretation-complete-guide",{"title":76,"path":77,"stem":78},"Social Network Analysis（SNA）深入解析","/data-analysis/social-network-analysis-sna","data-analysis/social-network-analysis-sna",{"title":80,"path":81,"stem":82},"Time-based Split：為什麼時間序列資料不能使用 Random Split？","/data-analysis/time-based-split-vs-random-split","data-analysis/time-based-split-vs-random-split",{"title":84,"path":85,"stem":86,"children":87,"page":41},"MachineLearning","/machine_learning","machine_learning",[88,92,96,100,104,108,112],{"title":89,"path":90,"stem":91},"Confusion Matrix（混淆矩陣）完整解析","/machine_learning/confusion-matrix","machine_learning/confusion-matrix",{"title":93,"path":94,"stem":95},"Decision Tree 模型完整教學：從原理到 Python 實作","/machine_learning/decision-tree-complete-guide","machine_learning/decision-tree-complete-guide",{"title":97,"path":98,"stem":99},"為什麼 Decision Tree 在 Tabular Data 上常常勝過 Deep Learning？","/machine_learning/decision-tree-vs-deep-learning-on-tabular-data","machine_learning/decision-tree-vs-deep-learning-on-tabular-data",{"title":101,"path":102,"stem":103},"LightGBM 模型入門：理解高效能的 Gradient Boosting 演算法","/machine_learning/lightgbm-intro-for-tabular-data","machine_learning/lightgbm-intro-for-tabular-data",{"title":105,"path":106,"stem":107},"Logistic Regression（Logit 回歸）完整教學","/machine_learning/logistic-regression-complete-guide","machine_learning/logistic-regression-complete-guide",{"title":109,"path":110,"stem":111},"為什麼模型訓練需要 Train / Validation / Test Dataset？","/machine_learning/train-validation-test-dataset","machine_learning/train-validation-test-dataset",{"title":113,"path":114,"stem":115},"XGBoost 原理與實務教學","/machine_learning/xgboost-complete-guide","machine_learning/xgboost-complete-guide",{"title":117,"path":118,"stem":119,"children":120,"page":41},"Network","/network","network",[121],{"title":122,"path":123,"stem":124},"DNS 設定入門：CNAME vs A Record 完整解析","/network/dns-cname-vs-a-record-guide","network/dns-cname-vs-a-record-guide",{"title":126,"path":127,"stem":128,"children":129},"Nuxt","/nuxt","nuxt",[130,133,137,141,145,149,153,157],{"title":131,"path":127,"stem":132},"Nuxt 實戰指南","nuxt/index",{"title":134,"path":135,"stem":136},"Abstraction Layer 與 Adapter 的差別，一次搞懂設計角色","/nuxt/adapter_abstraction_layer","nuxt/adapter_abstraction_layer",{"title":138,"path":139,"stem":140},"Nuxt 4 全面理解 — 專案檔案結構解析","/nuxt/directory_structure","nuxt/directory_structure",{"title":142,"path":143,"stem":144},"Nuxt 前端 build 流程完整解析","/nuxt/frontend_build","nuxt/frontend_build",{"title":146,"path":147,"stem":148},"Nitro 是什麼？從 Nuxt 專案到 Server 與 Edge 的關鍵引擎","/nuxt/nitro","nuxt/nitro",{"title":150,"path":151,"stem":152},"深入理解 Nuxt 的 .nuxt 與 .output：為什麼部署時一定要分清楚？","/nuxt/nuxt_and_output","nuxt/nuxt_and_output",{"title":154,"path":155,"stem":156},"Nuxt 中 dev、build、preview 的差異一次搞懂","/nuxt/nuxt_dev_build_preview","nuxt/nuxt_dev_build_preview",{"title":158,"path":159,"stem":160},"Nuxt Image vs \u003Cimg>：為什麼 Nuxt 3 專案幾乎都該用 \u003CNuxtImg>？","/nuxt/nuxt_image","nuxt/nuxt_image",{"title":162,"path":163,"stem":164,"children":165},"Python 程式開發","/python","python/index",[166,167,171,175],{"title":162,"path":163,"stem":164},{"title":168,"path":169,"stem":170},"如何在 FastAPI 中調用記憶體 Buffer 回傳圖片 (附實例)","/python/memory_buffer","python/memory_buffer",{"title":172,"path":173,"stem":174},"Python 單元測試教學：如何為你的程式撰寫 Test","/python/python-unit-testing-unittest-pytest","python/python-unit-testing-unittest-pytest",{"title":176,"path":177,"stem":178},"如何使用 uv 取代 pip：改善 Python 專案的開發流程","/python/uv","python/uv",{"title":180,"path":181,"stem":182,"children":183,"page":41},"Statistic","/statistic","statistic",[184,188,192,196],{"title":185,"path":186,"stem":187},"卡方檢定（Chi-Square Test）入門教學","/statistic/chi-square-test-intro","statistic/chi-square-test-intro",{"title":189,"path":190,"stem":191},"常見抽樣方法（Sampling Methods）教學：Stratified、Quota、Convenience、Systematic、Simple Random","/statistic/common-sampling-methods-guide","statistic/common-sampling-methods-guide",{"title":193,"path":194,"stem":195},"Cramér’s V 指標介紹：如何衡量兩個類別變數之間的關聯","/statistic/cramers-v-for-categorical-association","statistic/cramers-v-for-categorical-association",{"title":197,"path":198,"stem":199},"Mann–Whitney U 與 Kolmogorov–Smirnov（KS）檢定：非參數統計檢定的入門指南","/statistic/mann-whitney-u-and-ks-test-intro","statistic/mann-whitney-u-and-ks-test-intro",{"title":201,"path":202,"stem":203,"children":204},"WebDev","/web_dev","web_dev",[205,208,234,248,282,312,334],{"title":206,"path":202,"stem":207},"Web 前端開發","web_dev/index",{"title":209,"path":210,"stem":211,"children":212},"瀏覽器與渲染","/web_dev/browser","web_dev/browser/index",[213,214,218,222,226,230],{"title":209,"path":210,"stem":211},{"title":215,"path":216,"stem":217},"瀏覽器儲存空間完整解析：Cookie、localStorage、IndexedDB 到 Cache Storage","/web_dev/browser/browser-storage-comprehensive-guide","web_dev/browser/browser-storage-comprehensive-guide",{"title":219,"path":220,"stem":221},"DOM (Document Object Model) 深入解析","/web_dev/browser/dom","web_dev/browser/dom",{"title":223,"path":224,"stem":225},"Service Worker Request Flow 深入解析","/web_dev/browser/service-worker-request-flow","web_dev/browser/service-worker-request-flow",{"title":227,"path":228,"stem":229},"CSR、SSR 與 SSG 是什麼？前端渲染策略完整比較","/web_dev/browser/ssr_csr_ssg","web_dev/browser/ssr_csr_ssg",{"title":231,"path":232,"stem":233},"Virtual DOM 深入解析：為什麼它能優化前端效能？","/web_dev/browser/virtual_dom","web_dev/browser/virtual_dom",{"title":235,"path":236,"stem":237,"children":238},"圖形技術","/web_dev/graphics","web_dev/graphics/index",[239,240,244],{"title":235,"path":236,"stem":237},{"title":241,"path":242,"stem":243},"為什麼 Three.js 專案幾乎都選擇 CSR？從 SSR 問題談起","/web_dev/graphics/threejs_csr","web_dev/graphics/threejs_csr",{"title":245,"path":246,"stem":247},"WebGL 是什麼？為什麼前端 3D 幾乎都靠它？","/web_dev/graphics/webgl","web_dev/graphics/webGL",{"title":249,"path":250,"stem":251,"children":252},"架構與配置","/web_dev/infrastructure","web_dev/infrastructure/index",[253,254,258,262,266,270,274,278],{"title":249,"path":250,"stem":251},{"title":255,"path":256,"stem":257},"Zeabur + K3s + Nuxt 部署架構完整解析","/web_dev/infrastructure/k3s-zeabur","web_dev/infrastructure/K3s-zeabur",{"title":259,"path":260,"stem":261},"ECS vs Docker vs Kubernetes：從部署堆疊理解三層架構","/web_dev/infrastructure/ecs-docker-kubernetes-stack","web_dev/infrastructure/ecs-docker-kubernetes-stack",{"title":263,"path":264,"stem":265},"ECS vs VPS 是什麼？從部署網站的角度一次搞懂差別","/web_dev/infrastructure/ecs-vs-vps","web_dev/infrastructure/ecs-vs-vps",{"title":267,"path":268,"stem":269},"Zeabur 內網服務連線完整入門指南","/web_dev/infrastructure/k3s-internal-networking","web_dev/infrastructure/k3s-internal-networking",{"title":271,"path":272,"stem":273},"使用 Microservices 架構設計系統的優勢解析","/web_dev/infrastructure/microservices-architecture-advantages","web_dev/infrastructure/microservices-architecture-advantages",{"title":275,"path":276,"stem":277},"Nginx 入門教學：從反向代理到與 Kubernetes 的架構比較","/web_dev/infrastructure/nginx-intro","web_dev/infrastructure/nginx-intro",{"title":279,"path":280,"stem":281},"YAML 配置是什麼？為什麼現代開發都在用它","/web_dev/infrastructure/yaml-configuration","web_dev/infrastructure/yaml-configuration",{"title":283,"path":284,"stem":285,"children":286},"網絡與通訊","/web_dev/network","web_dev/network/index",[287,288,292,296,300,304,308],{"title":283,"path":284,"stem":285},{"title":289,"path":290,"stem":291},"HTTP Request 結構完整解析：從 Request Line 到 Header 一次看懂","/web_dev/network/http-request-structure","web_dev/network/http-request-structure",{"title":293,"path":294,"stem":295},"OSI 模型（Open Systems Interconnection Model）完整解析","/web_dev/network/osi-model","web_dev/network/osi-model",{"title":297,"path":298,"stem":299},"RESTful API 設計原則與實務解析","/web_dev/network/restful-api","web_dev/network/restful-api",{"title":301,"path":302,"stem":303},"RESTful API 五大設計原則深入解析","/web_dev/network/restful-api-principles","web_dev/network/restful-api-principles",{"title":305,"path":306,"stem":307},"Server-Sent Events (SSE) 深入解析與實作教學","/web_dev/network/sse-introduction","web_dev/network/sse-introduction",{"title":309,"path":310,"stem":311},"WebSocket 入門教學：從概念到 Node.js 實作","/web_dev/network/websocket-introduction","web_dev/network/websocket-introduction",{"title":313,"path":314,"stem":315,"children":316},"認證與安全","/web_dev/security","web_dev/security/index",[317,318,322,326,330],{"title":313,"path":314,"stem":315},{"title":319,"path":320,"stem":321},"使用 Cookie 與 Session 建立使用者驗證（完整新手教學）","/web_dev/security/cookie-session-authentication","web_dev/security/cookie-session-authentication",{"title":323,"path":324,"stem":325},"JWT 驗證機制完整解析：從登入流程到實務應用","/web_dev/security/jwt-authentication","web_dev/security/jwt-authentication",{"title":327,"path":328,"stem":329},"Secret Key 簽名是什麼？從零理解資料簽名的本質","/web_dev/security/secret-key-signing","web_dev/security/secret-key-signing",{"title":331,"path":332,"stem":333},"SSH（Secure Shell）是什麼？從遠端登入到安全通道的核心概念","/web_dev/security/ssh","web_dev/security/ssh",{"title":335,"path":336,"stem":337,"children":338},"SEO 與規範","/web_dev/seo","web_dev/seo/index",[339,340,344,348],{"title":335,"path":336,"stem":337},{"title":341,"path":342,"stem":343},"Canonical URL 是什麼？用生活化方式搞懂前端 SEO 的基本保命符","/web_dev/seo/canonical_link","web_dev/seo/canonical_link",{"title":345,"path":346,"stem":347},"robots.txt 是什麼？SEO 的第一道守門員","/web_dev/seo/robot_txt","web_dev/seo/robot_txt",{"title":349,"path":350,"stem":351},"Nuxt SEO 中的 Meta 與 SEO 工具是如何運作的？","/web_dev/seo/seo","web_dev/seo/seo",{"id":353,"title":297,"body":354,"description":1001,"extension":1002,"links":1003,"meta":1004,"navigation":1012,"path":298,"seo":1013,"stem":299,"__hash__":1014},"docs/web_dev/network/restful-api.md",{"type":355,"value":356,"toc":983},"minimark",[357,361,365,373,376,381,384,392,395,415,417,421,426,429,436,439,457,460,477,481,488,571,575,577,595,598,600,604,607,612,633,636,685,690,701,704,723,728,740,745,756,758,762,765,769,772,786,789,793,796,798,809,812,816,819,831,834,838,841,859,862,866,869,883,886,888,892,898,924,927,933,958,961,963,966,969,976,979],[358,359,297],"h1",{"id":360},"restful-api-設計原則與實務解析",[362,363,364],"p",{},"RESTful API 是現代 Web 系統中最常見的一種 API 設計風格（architecture style）。無論你是使用 Vue、Nuxt 建立前端，或是用 Node、Python 開發後端，幾乎都會與 RESTful API 互動。理解 REST 的設計思想，會直接影響你未來如何設計後端服務、如何規劃資料結構，甚至影響整體系統的可維護性。",[362,366,367,368,372],{},"REST 並不是一種框架，也不是一種技術或語言，而是一組 ",[369,370,371],"strong",{},"設計原則","。這個概念最早由 Roy Fielding 在 2000 年的博士論文中提出，完整名稱為 Representational State Transfer。REST 描述的是一種如何利用 HTTP 來設計分散式系統的方式，而 RESTful API 則是遵循這套設計原則所實作出來的 API。",[374,375],"hr",{},[377,378,380],"h2",{"id":379},"restful-api-是什麼","RESTful API 是什麼？",[362,382,383],{},"一句話理解：",[385,386,387],"blockquote",{},[362,388,389],{},[369,390,391],{},"RESTful API = 用「HTTP + 資源（resource）」來設計 API",[362,393,394],{},"也就是說：",[396,397,398,405,412],"ul",{},[399,400,401,402],"li",{},"API 的核心是 ",[369,403,404],{},"資源（resource）",[399,406,407,408,411],{},"使用 ",[369,409,410],{},"HTTP 方法","（GET / POST / PUT / DELETE）操作資源",[399,413,414],{},"而不是設計一堆「動詞式 API」。",[374,416],{},[377,418,420],{"id":419},"restful-的核心概念","RESTful 的核心概念",[422,423,425],"h3",{"id":424},"_1️⃣-resource資源","1️⃣ Resource（資源）",[362,427,428],{},"在 REST 的世界裡，一切都是「資源」。使用者是資源、文章是資源、訂單是資源、商品也是資源。API 設計的核心，不是「我要做什麼動作」，而是「我要操作哪個資源」。",[362,430,431,432,435],{},"資源通常用 ",[369,433,434],{},"名詞"," 表示，而不是動詞。",[362,437,438],{},"例如：",[396,440,441,447,452],{},[399,442,443],{},[444,445,446],"code",{},"/users",[399,448,449],{},[444,450,451],{},"/posts",[399,453,454],{},[444,455,456],{},"/orders",[362,458,459],{},"而不是：",[396,461,462,467,472],{},[399,463,464],{},[444,465,466],{},"/getUsers",[399,468,469],{},[444,470,471],{},"/createUser",[399,473,474],{},[444,475,476],{},"/deleteUser",[422,478,480],{"id":479},"_2️⃣-http-method-操作資源","2️⃣ HTTP Method = 操作資源",[362,482,483,484,487],{},"RESTful API 的核心精神是：",[369,485,486],{},"用 HTTP 動詞操作資源","。",[489,490,491,507],"table",{},[492,493,494],"thead",{},[495,496,497,501,504],"tr",{},[498,499,410],"th",{"align":500},"left",[498,502,503],{"align":500},"用途",[498,505,506],{"align":500},"範例",[508,509,510,526,541,556],"tbody",{},[495,511,512,518,521],{},[513,514,515],"td",{"align":500},[369,516,517],{},"GET",[513,519,520],{"align":500},"取得資料",[513,522,523],{"align":500},[444,524,525],{},"GET /users",[495,527,528,533,536],{},[513,529,530],{"align":500},[369,531,532],{},"POST",[513,534,535],{"align":500},"新增資料",[513,537,538],{"align":500},[444,539,540],{},"POST /users",[495,542,543,548,551],{},[513,544,545],{"align":500},[369,546,547],{},"PUT",[513,549,550],{"align":500},"更新資料",[513,552,553],{"align":500},[444,554,555],{},"PUT /users/1",[495,557,558,563,566],{},[513,559,560],{"align":500},[369,561,562],{},"DELETE",[513,564,565],{"align":500},"刪除資料",[513,567,568],{"align":500},[444,569,570],{},"DELETE /users/1",[422,572,574],{"id":573},"_3️⃣-url-代表資源位置","3️⃣ URL 代表資源位置",[362,576,438],{},[396,578,579,587],{},[399,580,581,583,584],{},[444,582,525],{}," 代表：",[369,585,586],{},"取得所有使用者",[399,588,589,583,592],{},[444,590,591],{},"GET /users/5",[369,593,594],{},"取得 ID = 5 的使用者",[362,596,597],{},"URL 描述的是「資源」，不是「行為」。",[374,599],{},[377,601,603],{"id":602},"restful-api-實務範例部落格系統","RESTful API 實務範例：部落格系統",[362,605,606],{},"假設我們設計一個簡單的文章 API。",[362,608,609],{},[369,610,611],{},"取得文章列表",[613,614,619],"pre",{"className":615,"code":616,"language":617,"meta":618,"style":618},"language-bash shiki shiki-themes github-dark","GET /posts\n","bash","",[444,620,621],{"__ignoreMap":618},[622,623,626,629],"span",{"class":624,"line":625},"line",1,[622,627,517],{"class":628},"svObZ",[622,630,632],{"class":631},"sU2Wk"," /posts\n",[362,634,635],{},"回傳：",[613,637,641],{"className":638,"code":639,"language":640,"meta":618,"style":618},"language-json shiki shiki-themes github-dark","[\n  { \"id\": 1, \"title\": \"Hello REST\" }\n]\n","json",[444,642,643,649,679],{"__ignoreMap":618},[622,644,645],{"class":624,"line":625},[622,646,648],{"class":647},"s95oV","[\n",[622,650,652,655,659,662,665,668,671,673,676],{"class":624,"line":651},2,[622,653,654],{"class":647},"  { ",[622,656,658],{"class":657},"sDLfK","\"id\"",[622,660,661],{"class":647},": ",[622,663,664],{"class":657},"1",[622,666,667],{"class":647},", ",[622,669,670],{"class":657},"\"title\"",[622,672,661],{"class":647},[622,674,675],{"class":631},"\"Hello REST\"",[622,677,678],{"class":647}," }\n",[622,680,682],{"class":624,"line":681},3,[622,683,684],{"class":647},"]\n",[362,686,687],{},[369,688,689],{},"新增文章",[613,691,693],{"className":615,"code":692,"language":617,"meta":618,"style":618},"POST /posts\n",[444,694,695],{"__ignoreMap":618},[622,696,697,699],{"class":624,"line":625},[622,698,532],{"class":628},[622,700,632],{"class":631},[362,702,703],{},"Request Body：",[613,705,707],{"className":638,"code":706,"language":640,"meta":618,"style":618},"{ \"title\": \"New Post\" }\n",[444,708,709],{"__ignoreMap":618},[622,710,711,714,716,718,721],{"class":624,"line":625},[622,712,713],{"class":647},"{ ",[622,715,670],{"class":657},[622,717,661],{"class":647},[622,719,720],{"class":631},"\"New Post\"",[622,722,678],{"class":647},[362,724,725],{},[369,726,727],{},"更新文章",[613,729,731],{"className":615,"code":730,"language":617,"meta":618,"style":618},"PUT /posts/1\n",[444,732,733],{"__ignoreMap":618},[622,734,735,737],{"class":624,"line":625},[622,736,547],{"class":628},[622,738,739],{"class":631}," /posts/1\n",[362,741,742],{},[369,743,744],{},"刪除文章",[613,746,748],{"className":615,"code":747,"language":617,"meta":618,"style":618},"DELETE /posts/1\n",[444,749,750],{"__ignoreMap":618},[622,751,752,754],{"class":624,"line":625},[622,753,562],{"class":628},[622,755,739],{"class":631},[374,757],{},[377,759,761],{"id":760},"restful-的-5-個重要設計原則","RESTful 的 5 個重要設計原則",[362,763,764],{},"這部分是「真正的 REST 精神」。",[422,766,768],{"id":767},"_1️⃣-clientserver-分離","1️⃣ Client–Server 分離",[362,770,771],{},"前端與後端分離。",[396,773,774,780],{},[399,775,776,779],{},[369,777,778],{},"Client","：Vue / Nuxt（負責 UI 與體驗）",[399,781,782,785],{},[369,783,784],{},"Server","：Node / Python（負責資料與邏輯）",[362,787,788],{},"這點其實跟你現在做的 Nuxt + API 架構很一致。這種分離讓系統更容易擴展與維護。",[422,790,792],{"id":791},"_2️⃣-stateless無狀態","2️⃣ Stateless（無狀態）",[362,794,795],{},"每個 request 必須包含完整資訊。Server 不應該記住 client 的狀態。",[362,797,438],{},[613,799,803],{"className":800,"code":801,"language":802,"meta":618,"style":618},"language-makefile shiki shiki-themes github-dark","Authorization: Bearer \u003Ctoken>\n","makefile",[444,804,805],{"__ignoreMap":618},[622,806,807],{"class":624,"line":625},[622,808,801],{},[362,810,811],{},"Server 只根據這次請求做判斷，而不是依賴先前的請求狀態。這種設計讓系統更容易擴展，因為任何一台伺服器都能處理請求，不需要共享 session。",[422,813,815],{"id":814},"_3️⃣-cacheable可快取","3️⃣ Cacheable（可快取）",[362,817,818],{},"HTTP response 可以被 cache。良好的 API 設計會利用 HTTP headers：",[396,820,821,826],{},[399,822,823],{},[444,824,825],{},"Cache-Control",[399,827,828],{},[444,829,830],{},"ETag",[362,832,833],{},"如果設計良好，API 回應可以被瀏覽器或 CDN 快取，大幅降低伺服器負載。",[422,835,837],{"id":836},"_4️⃣-uniform-interface統一介面","4️⃣ Uniform Interface（統一介面）",[362,839,840],{},"這是 REST 最重要的一點：",[396,842,843,848,853,856],{},[399,844,845],{},[369,846,847],{},"URL 表示資源",[399,849,850],{},[369,851,852],{},"HTTP method 表示操作",[399,854,855],{},"使用標準 HTTP status code（200, 201, 400, 404）",[399,857,858],{},"使用統一資料格式（通常是 JSON）",[362,860,861],{},"一致的介面設計，讓 API 可預測、可理解，也更容易被第三方整合。",[422,863,865],{"id":864},"_5️⃣-layered-system分層","5️⃣ Layered System（分層）",[362,867,868],{},"Client 不需要知道請求最終由哪一層處理。中間可能包含：",[396,870,871,874,877,880],{},[399,872,873],{},"API server",[399,875,876],{},"Proxy",[399,878,879],{},"Load Balancer",[399,881,882],{},"Microservices",[362,884,885],{},"Client 只知道「我打到某個 URL」，但實際處理可能經過多層架構。這種分層讓系統更容易擴展與重構。",[374,887],{},[377,889,891],{"id":890},"restful-vs-傳統-api","RESTful vs 傳統 API",[362,893,894,897],{},[369,895,896],{},"傳統 RPC 風格 API"," (偏動詞)",[613,899,901],{"className":615,"code":900,"language":617,"meta":618,"style":618},"POST /createUser\nPOST /deleteUser\nPOST /updateUser\n",[444,902,903,910,917],{"__ignoreMap":618},[622,904,905,907],{"class":624,"line":625},[622,906,532],{"class":628},[622,908,909],{"class":631}," /createUser\n",[622,911,912,914],{"class":624,"line":651},[622,913,532],{"class":628},[622,915,916],{"class":631}," /deleteUser\n",[622,918,919,921],{"class":624,"line":681},[622,920,532],{"class":628},[622,922,923],{"class":631}," /updateUser\n",[362,925,926],{},"這種設計強調「動作」，比較像在呼叫函式。",[362,928,929,932],{},[369,930,931],{},"RESTful API"," (偏資源)",[613,934,936],{"className":615,"code":935,"language":617,"meta":618,"style":618},"POST /users\nDELETE /users/1\nPUT /users/1\n",[444,937,938,945,952],{"__ignoreMap":618},[622,939,940,942],{"class":624,"line":625},[622,941,532],{"class":628},[622,943,944],{"class":631}," /users\n",[622,946,947,949],{"class":624,"line":651},[622,948,562],{"class":628},[622,950,951],{"class":631}," /users/1\n",[622,953,954,956],{"class":624,"line":681},[622,955,547],{"class":628},[622,957,951],{"class":631},[362,959,960],{},"這種方式強調「資源」。當 API 數量變多時，資源導向的設計更容易維持一致性，也更容易讓其他開發者理解。",[374,962],{},[377,964,965],{"id":965},"一句話總結",[362,967,968],{},"RESTful API 的本質是：",[385,970,971],{},[362,972,973],{},[369,974,975],{},"用 HTTP 方法操作資源，並讓 URL 表示資源位置。",[362,977,978],{},"當你理解 REST 是一種「架構思想」，而不是一種「技術規格」時，你就會開始用更系統化的方式設計 API。這對於建立可維護、可擴展的系統架構至關重要。",[980,981,982],"style",{},"html pre.shiki code .svObZ, html code.shiki .svObZ{--shiki-default:#B392F0}html pre.shiki code .sU2Wk, html code.shiki .sU2Wk{--shiki-default:#9ECBFF}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html pre.shiki code .s95oV, html code.shiki .s95oV{--shiki-default:#E1E4E8}html pre.shiki code .sDLfK, html code.shiki .sDLfK{--shiki-default:#79B8FF}",{"title":618,"searchDepth":651,"depth":651,"links":984},[985,986,991,992,999,1000],{"id":379,"depth":651,"text":380},{"id":419,"depth":651,"text":420,"children":987},[988,989,990],{"id":424,"depth":681,"text":425},{"id":479,"depth":681,"text":480},{"id":573,"depth":681,"text":574},{"id":602,"depth":651,"text":603},{"id":760,"depth":651,"text":761,"children":993},[994,995,996,997,998],{"id":767,"depth":681,"text":768},{"id":791,"depth":681,"text":792},{"id":814,"depth":681,"text":815},{"id":836,"depth":681,"text":837},{"id":864,"depth":681,"text":865},{"id":890,"depth":651,"text":891},{"id":965,"depth":651,"text":965},"深入理解 RESTful API 的核心概念、五大設計原則與實務範例，建立正確的 API 架構思維。","md",null,{"tags":1005,"category":203,"date":1011},[1006,1007,1008,1009,1010],"restful","api","http","backend","web","2026-02-12",true,{"title":297,"description":1001},"IJrJU3aQFAM5VFrtbXf6UzpWKNmwWyU0wZdeHvXf0iU",[1016,1018],{"title":293,"path":294,"stem":295,"description":1017,"children":-1},"從概念到實務，深入理解 OSI 七層模型如何運作，並掌握網路系統設計的核心思維。",{"title":301,"path":302,"stem":303,"description":1019,"children":-1},"從 REST constraints 出發，理解 RESTful API 為何這樣設計，以及每個原則在實務開發中的意義與常見錯誤。",1776690847627]