最近接觸到一個新的概念:endpoint
, 是覺得記web
An endpoint is the 'connection point' of a service, tool, or application accessed over a network. In the world of software, any software application that is running and "listening" for connections uses an endpoint as the "front door." When you want to connect to the application/service/tool to exchange data you connect to its endpoint.bash
Simply put, an endpoint is one end of a communication channel. When an API interacts with another system, the touchpoints of this communication are considered endpoints. For APIs, an endpoint can include a URL of a server or service. Each endpoint is the location from which APIs can access the resources they need to carry out their function.
APIs work using ‘requests’ and ‘responses.’ When an API requests information from a web application or web server, it will receive a response. The place that APIs send requests and where the resource lives, is called an endpoint.app
endpoint
在 RESTful
風格下一般看起來是這樣:ide
/this-is-an-endpoint
/another/endpoint
/some/other/endpoint
/login
/accounts
/cart/items
複製代碼
放在某個域名下:this
https://example.com/this-is-an-endpoint
https://example.com/another/endpoint
https://example.com/some/other/endpoint
https://example.com/login
https://example.com/accounts
https://example.com/cart/items
複製代碼
http
或者 https
均可以,這裏只是用 http
舉例。spa
HTTP method
不一樣,endpoint
看起來也不同, 好比說:code
GET /item/{id}
PUT /item/{id}
複製代碼
這是兩個不一樣的 endpoints
, 一個是用於 CRUD
的 R
(Retrieving), 一個是用於 CRUD
的 U
(updating)orm