GithubHelp home page GithubHelp logo

文档中的疑问 about dubbox HOT 8 CLOSED

dangdangdotcom avatar dangdangdotcom commented on July 21, 2024
文档中的疑问

from dubbox.

Comments (8)

li-shen avatar li-shen commented on July 21, 2024

这个不需要什么特殊操作,直接把文档中get的示例中后端调用的逻辑改成删除即可。这些rest实现和一般实现一个网页中用get/post实现增删改查应该类似。

from dubbox.

wanghaisheng avatar wanghaisheng commented on July 21, 2024

您好,如果是删除也走get的话,url是不是会做特殊处理,比如说
http://localhost/user/001?delete_flag=true(默认为flase就认为是读取操作)
还是说保持
http://localhost/user/001
如果是后者的话,是如何来区分读取还是删除操作呢 谢谢耐心的回复

from dubbox.

Tean avatar Tean commented on July 21, 2024

我认为
http://localhost/user/001/del
这种风格的行为辨识也不是不能接受

from dubbox.

li-shen avatar li-shen commented on July 21, 2024

是的,没必要严格遵照rest的原始风格

from dubbox.

wanghaisheng avatar wanghaisheng commented on July 21, 2024

或者这样问好了,要通过GET 实现删 和POST实现改 有没有一些你们总结的best practice?
http://localhost/user/001/del 这种是我暂时能想到的一种看起来很拙劣的方法呢

from dubbox.

li-shen avatar li-shen commented on July 21, 2024

我们没有这方面总结,你可以参考下新浪和twitter之类的open api,它们有大量现成的例子。。当然新浪的delete应该是用post做的

上面那种形式谈不上拙劣,很正常,就是用/user/delete/1或者/user/delete?id=1我觉得都可以接受

from dubbox.

danielwii avatar danielwii commented on July 21, 2024

对服务器有操作的如果放在get请求中,会不会可能被其他位置缓存导致操作无法执行。
非get请求可用加入一个参数(_method)的方式来区别(PUT、DELETE)。

from dubbox.

li-shen avatar li-shen commented on July 21, 2024

这个是取决于你们具体的业务和部署

from dubbox.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.