mercredi 1 juin 2022

api design | input parameters should be an object or just multiple params

When I design an api that includes 5 input parameters, should the parameters be passed in in the form of objects, or just multiple params

PS: There is no relationship between parameters

const apiMethod = (parma1, parma2, parma3, parma4, parma5) => {……}

or

let param = {parma1, parma2, parma3, parma4, parma5}
const apiMethod = (param) => {
  ...param
  // ……
}

which one is best?

Aucun commentaire:

Enregistrer un commentaire