Restful
简单来说:就是客户端和服务器的进行交互过程。在这个互动的过程,客户端要访问资源Resources,资源是一个名词,有很多类型。这就涉及到了传递资源以某种形式转换的过程到服务器
一:概念
二:特点
1.资源
每一个 URI 代表一种资源
URI:统一资源定位符
URL:统一资源标识符,http
URL在URI里面
所谓“上网”,就是与互联网上一系列的“资源”互动,调用它的 URI。
2.表现层
客户端和服务器之间,传递这种资源的某种表现层
3.状态转移
客户端通过四个 HTTP 动词,对服务器端资源进行操作,实现“表现层状态转化”。
三:举例
-
获取学生资源
GET http://localhost:3000/students
-
搜索学生
GET http://localhost:3000/students?type=name&value="张"
-
根据ID获取某个学生
GET http://localhost:3000/sstudent/学生id
-
增加学生
POST http:localhost:3000/students/学生id
-
修改学生
PUT http:localhost:3000/students/学生id PATCH http:localhost:3000/students/学生id
-
删除学生
DELETE http:localhost:3000/students/学生id
四:postman工具
除学生
DELETE http:localhost:3000/students/学生id