Home > Blockchain >  is this a good practice when working with user profile data?
is this a good practice when working with user profile data?

Time:11-12

i making route for updating user profile data i come with this solution

Router.route("/login").post(userController.Login);
Router.route("/register").post(userController.Register);
Router.route("/profile/update/cover").patch(userController.UpdateProfileCover);
Router.route("/profile/update/details").patch(
  userController.UpdateProfileDetails
);
Router.route("/profile/update/photo").patch(userController.UpdateProfilePhoto);
Router.route("/profile/update/email").patch(userController.UpdateProfileEmail);
Router.route("/profile/update/password").patch(
  userController.UpdateProfilePassword
);

the app will allow user to upload images and verfiy email and password

is this a good practice or there are alternative when it come to this type of situation

CodePudding user response:

You are basically doing the following

SELECT entity from User -> Validate -> Update User's Entity

On every time user is calling the API, why not adding save button to on your UI and send all changes all at once, this will help reducing queries and resources needed, this is crucial especially when you scale.

other than that it is acceptable.

  • Related