7

So this is my first experience of shitty code written by colleague

God, for REST API she used ?id=<int>
Not only that,
if the route was /cms

she used GET method for /cms/get/?id= to get single record and
/cms/getAll again in GET method to get all records

Damn

Comments
  • 4
    Thats bad practice, but its ok compared to really bad code.
  • 3
    No, it’s not ok. It’s fucking terrible
  • 0
    @Plasticnova +1
    I'm a python developer but for experience with node I got role of project architect in this project.

    And I'm not going to deal with shitty code base, I even insist on using correct spelling for response messages (some minor typos)

    There are few things where you can't compromise with
  • 1
    @chowdercake do yourself a favor though and take notes of the issues you won’t be tackling. Making sure this data gets upstream might help you out down the road as well
  • 4
    If that's "shitty code" for you then you still haven't seen real shit :)

    at least it's deterministic ;)
  • 5
    It's an API, not rest. Not all APIs need to be rest.
  • 2
    @dfox weren't the user IDs like that before 😀

    I remember urls like users/40001
  • 0
    @billgates that's not like ops example.
    What you are saying is almost rest (should not be plural)
  • 0
    @Codex404 we discussed it to be rest and are following the standards
  • 0
    Looks perfectly fine.
    What’s your problem >? Are you bitching about adding an id to your request?
    These APIs are 1000 more clean than 75% of compagnies provide.
    I know one, which uses URL parameters to submit data filters in a super weird format.
  • 0
    Oh wait, so your problem is it's "cms/?id=4" instead of "cms/4" ? It does not violate REST definition of unique resource by URL
  • 1
    @NoToJavaScript it does violate the rest specs.
  • 0
    @Codex404 Which part ? Asking for a friend

    What I see is : Use of a uniform interface (UI). Resources should be uniquely identifiable through a single URL, and only by using the underlying methods of the network protocol, such as DELETE, PUT and GET with HTTP, should it be possible to manipulate a resource
  • 1
    In rest you don't pass query parameters, you pass it on url
  • 0
    @NoToJavaScript and the point is not whether it violates or not

    We discussed the standards (url formats) that we are going to follow (and agreed upon) and I have been insisting on keeping it as discussed

    And after all that if someone tries to fuck it up that's just diabolic or retarded
Add Comment