java - 有人能说明下什么是restful吗?
黄舟
黄舟 2017-04-18 09:33:20
0
5
511
黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

reply all(5)
Ty80

This is restful, the advantage is to standardize uri, stateless
Replace this with
https://segmentfault.com/getQuestion.action?id=1010000005831178https://segmentfault.com/getQuestion.action?id=1010000005831178
你会发现:
如果我不想用id做字段名怎么办,前后端一起调一下
如果我不想用getQuestionYou will find:

If I don’t want to use it What should I do if id is used as a field name? Adjust the front-end and back-end together

What if I don’t want to use getQuestion as a method? Adjust the front-end and back-end together

But with restful, there is no such problem. The format is set and the background can be adjusted at will.

🎜That’s all I can say🎜
洪涛

Generally, the API of WEB applications will be designed in a restful manner. The things that the API operates are called resources, and the operation method is the request method (GET, POST, DELTE, PUT).
Consider each request as an access to resources. Use Some verbs express operations on resources (add, delete, check, modify)
/GET/id/{id} //Get resources
/POST //Create resources
/PUT //Update resources
/DELET/id/{ id} //Delete resource

Click here for details

巴扎黑

Recommend you to read Ruan Yifeng’s Understanding RESTful Architecture

大家讲道理

https://www.zhihu.com/question/28557115
Personally, I feel this is a post that explains restful well. Please focus on Qin Chao’s answer.

迷茫

Hello, will you do the random push on the WeChat public platform? If it's convenient, add me on QQ? 20998710, or my phone number is 18705947972

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!