IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    RESTful is bad and you should feel bad

    est\'s blog发表于 2017-04-12 11:10:11
    love 0

    From this thread

    What’s wrong with

    GET     /users/                ----->  `list.users` 
    GET     /users/:id/            ----->  `retrieve.users`
    POST    /users/                ----->  `create.users`
    PUT     /users/:id/password/   ----->  `replace.users`
    PATCH   /users/:id/            ----->  `update.users`
    DELETE  /users/:id/            ----->  `destroy.users`
    

    You will find these URL super ugly and annoying when doing log analysis, you have to monkey craft regexps to truncate the useless :id part from the url so your aggregator would work properly.

    I prefer simply use GET for read and POST for writes. Like this

    GET /users/list
    GET /users/retrieve
    POST /users/create
    POST /users/update
    POST /users/destroy
    

    It’s clean, it’s concise, it works everywhere.

    Fuck those obnoxious OPTIONS and PATCH.

    BTW who the fuck invents a users.replaec() functions?



沪ICP备19023445号-2号
友情链接