Rails 1.2 is just around the corner and the entire world is on the
verge of going REST crazy. There has been mention (from DHH at times)
of tutorials to show how to think RESTfully and fit in most
comfortably with the Rails way. An online store is always a popular
example and I went through the exercise to see how I might make a
store REST friendly. Below are the URL's I came up with for a basic
store front with the common parts of a store interface for customers.
It could be that some of these URL's should be disguised for a
friendlier user experience but the URL's below are what I think of as
the raw REST-based URLs. If anyone has suggestions for changes I'd be
interested to read the reasons or see examples of other types of apps
and their URLs.
store splash page entrance
list of departments
department 23 page
list of products in the department
what we think of as the product 31 page
shows the form to create a new cart_item based on product 31 with
options and quantity
has the "add to cart" button
create a new cart item based on form information including product id
redirects to cart
show the form to edit a cart item. If this cart item is for product 31
then we will see this as the product 31 page again but the button will
say "update" instead of "add to cart".
updates a cart item based on form information including cart_item id
redirects to cart
delete link shown on cart view page
removes an item from the cart
wants html: redirects to cart
show the shopping cart
has the "checkout" button
form to checkout (shipping, credit card info)
has the "finalize" button
finalize the purchase
redirects to "thanks for purchase page"
the "thanks for purchase page" with a receipt.
customer order history with shipping status etc
form to create an account
create a new customer account
starts a new session like logging in would
redirect to "thanks for signing up page"
show customer his details
edit customer details
update customer details
redirect to show customer details
customer login page (sessions are sort of singletons per customer)
does not actually delete the session as another login can restore it.
redirect to "thank you for shopping" page or back to the page where
the logout was initiated if allowed there in logged out state