How to make multiple update on the sequelize framework?

  node.js, question

I used express to make restful api interface, and the front end used angular1.5 $http calling interface. Before that, I only updated one piece of data without too much problem. The code is as follows:

Express api section

router.put('/animals', (req, res, next) => {
 let animal = req.body;
 where: {
 idNo: animal.idNo
 }).then(function (data) {
 data.updateAttributes(animal).then(function (animal) {

Angular part

 method :  'PUT' ,
 url :  '/api/animals' ,
 data :  animal,
 headers :  { 'Content-Type' :  'application/json' }
 Alert ('Update Successful');

However, I would like to update a lot of data now. There are many animal in an array. At present, there are two ideas:

  1. The api interface does not change. Write a for loop in angular and call the same interface many times. However, it seems that it needs to write a closure to determine if all update is complete.

  2. Change the api part, angular passes in the entire array at a time, and then updates it with some functions of sequelize. At present, only two methods are seen in this part.

    1. use promise.all for all updates
     2. The same wording just puts the for loop in the api
     3. perhaps a bit more advanced can take advantage of the function of transaction, if there is an update fails to rollback?  ?  I've never used this before. I don't know

May I ask which method is better and how will it be implemented? Thank you

At present, using the $q provided by Angular1.5, you can send an array of $http request (promise) one at a time, and then use $q.all to obtain the result. the specific code is as follows:

var qPromiseArr = [];
 for(var i=0;  i<switchingCageAnimals.length;  I plus)
 qPromiseArr.push( $http({
 method :  'PUT' ,
 url :  '/api/animals' ,
 data :  switchingCageAnimals[i],
 headers :  { 'Content-Type' :  'application/json' }
 //dataList is an Object Array that can get the result returned by http every time.

It is suggested to do it at the back end of API.
An array is passed from the front end.
The back-end performs for, update, and can also add transaction .