2 ms·
What if you need state for users without username and password? For instance let them add things to their cart and only require registraton/login once they buy
by njharman 18y ago
What if you need state for users without username and password?
For instance let them add things to their cart and only require registraton/login once they buy.
What if you want more than one basket?
What if baskets are shared among users.
Replace "basket" with "state" for above.
How is http://example.org/shop/users/johndoe/basket http://example.org/shop/users/johndoe/basket different/better than http://example.org/shop/users/johndoe/?sessionkey=123456 http://example.org/shop/users/johndoe/?sessionkey=123456 or http://example.org/shop/baskets/123456/ http://example.org/shop/baskets/123456/
"differ from storing the cart in a user session" I never store anything but sessions in user sessions, carts go in the cart table/whatever. Carts may have a session_id they are associated with, but they are probably keyed to user instead(depends). Probably stored in a cookie(state on the client).
Not saying author is wrong, I just don't get it.
And how come rest folks don't end their resources with a '/'. like http://example.com/users/bob/ http://example.com/users/bob/ The "root" resource ends in a slash. http://example.com/ http://example.com/ Having that be inconsistent with other resources always bugs me. I tend to have verbs not end in slash. http://example.com/users/bob/delete http://example.com/users/bob/delete Very consistent and orderly to my obcom mind.