Hi, I am currently building and learning at the same time. As this is very territory for me , I need advice and some suggestion on the following api design :
base root url is /user
## BASIC ROUTE - code rewritten already
/user/:id/discounts for post and get request
/user/:id/discounts/:discount_id for get and put request for master -detail page
/user/:id/discounts/:discount_id/reviews for post and get posting reviews
/user/:id/favorites for post and get request for adding personal collection of item
/user/:id/favorites/:fav_id for deleting favorites request
### ADVANCED ROUTES advanced because keep getting alot of errors here
/user/:id/discounts?category=category get request for specific category string
/user/:id/discounts?discount=discount get request for specific discount percentage integer
stretch goals
/user/:id/discounts/topdeals get request for top trending deals / post request for pay to be featured
/user/:id/discount/magic sort by magic feature as seen on kickstater.com
TECHNOLOGIES
Express, Mongoose with middleware auth on /:id on each api call. I am currently not implementing this, but is this the ideal structure? Any suggestion or optimization or comment is very welcome. I am willing to explore any ideas or stack that can be more useful than what I am doing currently.
Marco Romero
Front-end Engineer
You are going in the proper direction so far. Keep your URL route params to refer to resources and just use query params to filter results. You can follow the guidelines outputted here: vinaysahni.com/best-practices-for-a-pragmatic-res…