Reputation: 65
res.json(Object.assign({}, cart.generateArray()));
res.json(JSON.stringify(cart.totalPrice));
how can i send Sending multiple responses because my code doesn't work
thank you
Upvotes: 4
Views: 15140
Reputation: 31761
You cannot send multiple responses. You send an object that contains your array and total price:
res.json({
items: cart.generateArray(),
totalPrice: cart.totalPrice
});
Another option would be to make two different requests if you need two responses.
Upvotes: 16