REST Shopping cart

后端 未结 5 1015
野的像风
野的像风 2020-12-08 16:48

Can a shopping cart be implemented using REST architecture constraints?

I would like to focus my question with respect to session state. In a typical MVC applicatio

5条回答
  •  感情败类
    2020-12-08 16:56

    Yes you can,

    Shopping cart data (added products) can be saved on the clients session, that ain't a problem.

    Then once the user hits /checkout, the shopping cart should be persisted on the DB on the server. The key about rest is that every petition the client makes has to contain all data to identify himself, I suggest reading something about JWT or OAuth.

    The app itself would work as any other shopping cart app you have seen, most of them do not persist the shopping cart in DB, just store it the clients session.

提交回复
热议问题