Open Massimiliano-Perelli opened 6 years ago
IMO that would make the library too much opinionated. children
property is not the only way to reflect hierarchical data. Another user might have/need a flat data structure where the children would have a parentId
property on them to reflect the relation.
Sorry, it is possible to have something like this and than call api/heroes/11/children/13 to get Bombasto?
createDb() { const heroes = [ { id: 11, name: 'Mr. Nice', children: [ { id: 13, name: 'Bombasto' }, { id: 14, name: 'Celeritas' }, ] }, { id: 12, name: 'Narco' } ]; return {heroes}; }