当前位置:网站首页>Basics - rest style development
Basics - rest style development
2022-07-05 11:08:00 【Printf ('xiaobai ');】
REST Style development
How to write it
- Representational State Transfer, Representation state transition
- advantage
- Hide access behavior , It is impossible to know what kind of operation the resource is through the address
Writing simplification
- Hide access behavior , It is impossible to know what kind of operation the resource is through the address
http://locahost/users Query all user information GET
http://locahost/users/1 Query individual user information GET
http://locahost/users Add user information POST
http://locahost/users Modify user information PUT
http://locahost/users/1 Delete user information DELETE
- It's a style, not a norm , With REST Style development is called RESTFUL
- The name describing the module is usually plural , That is to say, add s Format description of , Indicates such resources , Not a single resource , for example users, books, accounts
Several notes
@RequestBody @RequestParam @PathVariable
- difference
- @RequestParam It is used to receive
url Address reference
perhapsPass the form to the reference
@RequestBody be used forreceive json data
@PathVariable Used to receive path parameters , Use{ Parameter name }
Describe path parameters
- @RequestParam It is used to receive
- application
- Later development , Hair
Send request parameters more than one
when , Withjson Mainly
,@RequestBody It is widely used
send outNot json Format data
, choose @RequestParam Receive request parametersuse RESTful Development , When the number of parameters is small
, For example, one , May adopt @PathVariable Receive request path variable , Usually used for id Pass value
- Later development , Hair
@RestController
- yes @Controller and @ResponseBody The aggregate of
@PostMapping
- @RequestMapping(method = RequestMethod.POST)
边栏推荐
猜你喜欢
Ddrx addressing principle
【Oracle】使用DataGrip连接Oracle数据库
About the use of Vray 5.2 (self research notes)
R3live series learning (IV) r2live source code reading (2)
Repair animation 1K to 8K
修复动漫1K变8K
Some understandings of heterogeneous graphs in DGL and the usage of heterogeneous graph convolution heterographconv
如何将 DevSecOps 引入企业?
About the use of Vray 5.2 (self research notes) (II)
Lombok 同时使⽤@Data和@Builder 的坑,你中招没?
随机推荐
埋点111
Operation of simulated examination platform of special operation certificate examination question bank for safety production management personnel of hazardous chemical production units in 2022
Share Net lightweight ORM
购买小间距LED显示屏的三个建议
2021 Shandong provincial competition question bank topic capture
Common functions of go-2-vim IDE
数据库三大范式
Msfconsole command encyclopedia and instructions
Nuxt//
Repair animation 1K to 8K
关于vray5.2怎么关闭日志窗口
Deepfake tutorial
How to make full-color LED display more energy-saving and environmental protection
Talk about the understanding of fault tolerance mechanism and state consistency in Flink framework
NAS and San
Lombok 同时使⽤@Data和@Builder 的坑,你中招没?
[first release in the whole network] (tips for big tables) sometimes it takes only 1 minute for 2 hours of SQL operation
A usage example that can be compatible with various database transactions
Bidirectional RNN and stacked bidirectional RNN
DDRx寻址原理