My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more

Structuring API backend for mobile app (Ionic)

Madiba Razak's photo
Madiba Razak
·Aug 6, 2015

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.