Hi all -
I’m looking for some advice on how to set up an interface for my single-page application. Basically, my app will load an object with a whole lot of structure. I’m building an auction-style store application that has categories, groups and products where people can choose one product from each group. Something like this:
{
"title": "this is totes awesome",
"categories": [{
[{
"id": "37897we98r",
"title": "totes awesome tshirts"
"groups": [
[
{
"id": "123",
"title": "Everything is Awesome!"
"available": 12
},
{
"id": "345",
"title": "When you're part of a Team"
"available": 10
}
],
[
{
"id": "123",
"title": "Lorem Ipsum dolor"
"available": 10
},
{
"id": "345",
"title": "Fake latin rulz"
"available": 10
}
]
]
}] [and another group with categories and products...]
}]
}
There will only ever be one top level store object, but the number of categories, groupings and products are variable.
Also, to muddy the waters, there will be live updates from the server (via sockets) so that product-level data is updated as people purchase products (i.e. the inventory decreases).
I believe I need api points at the tournament, category and product end-point, so I’m not sure how to structure my models. I’m cautious about having a large number of API requests as well, so any advice would be greatly appreciated.
Right now, the backend API is being designed so we have flexibility there. I’m 99% sure we’ll be rolling a Rails solution…
Thanks for any guidance.