Giter Club home page Giter Club logo

Comments (1)

JamesChenX avatar JamesChenX commented on June 23, 2024

Draft notes:

  • Use singular nouns always because:
    • Using plural nouns is confusing for some resources like cluster leader because there is only one cluster and leader for any turms servers. If there is more than one leader or cluster, it's a bug, so it is more reasonable to use singular nouns here, i.e.: /cluster/member.
    • Using consistent names, so using singular nouns always.
    • It has no benefit to use plural nouns.
  • Move query filters from the URL query params into the request body in JSON because:
    • Using URL query params is painful to construct and parse complex filters, e.g. ?mylist%5B0%5D.name=abc&mylist%5B0%5D.age=123&mylist%5B1%5D&name="zxc".
    • It's consistent and easy to use JSON in any programming language.
  • Always use a map/object as the value of the response data, and never use a list because of its schema flexibility.
  • Use POST consistently and move the action to the URL because:
    • Some proxies and companies disable HTTP request methods like DELETE by default, which will cause troubles for Turms users.
    • Many HTTP clients don't allow sending request body when using GET and DELETE.
  • The endpoints should follow the pattern <domain>/<resource>/<action> (e.g. business/group/member/create)
  • One endpoint should have only one request/response schema (it is the same as before, I mention it again because it's a very important principle)
  • Represent datetime values in int64 number (millis since unix epoch) instead of string because millis since unix epoch is: 1. easy and convenient to parse by any programming language; 2. no ambiguity compared to string.

I mark this issue as a high priority because there are many new endpoints that can only be published after these changes.

from turms.

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.