The RESTful flow?

前端 未结 8 1253
傲寒
傲寒 2021-01-16 06:34

So...

I\'ve been reading about REST a little bit, and the idea behind it sounds nice, but the question is, can it be easily integrated into the standard flow of a we

8条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-16 07:13

    Depending on what framework you use, there are models that determine how actions are handled for each resource.

    Basically using another parameter, you want to send the resource what action to perform. That parameter may be sent through AJAX/JS for example.

    If you want to do it without javascript/ajax (in case it's disabled), then a form POST method would work as well, sending the resource the extra ACTION parameter.

    Of course, in both cases, you have to consider security, and make sure that they're not sending the resource an action they shouldn't be. Make sure to do your checking on the backend, and send an appropriate response or error message.

    Client side scripting, whether through JS/Ajax or form POST or other methods require the extra security precaution.

    Edited after clarification from poster.

提交回复
热议问题