How do I store cart session using loopback?

307 Views Asked by At

This is my first project , I am building a RESTful API using Loopback Nodejs framework. Users can add and remove items from their carts but need to be authenticated to pay. How do I deal with that ? Should I :

  1. post and save the current cart in the database and every time a user adds an item I post it to the database
  2. Or store the current cart on the client side until the user pays I post it to the database
  3. Or post items and save them in a memory cache
  4. Is it better to have an Api endpoint like myapp.com/cart and get the current cart using user token or myapp.com/cart/{id} ?
0

There are 0 best solutions below