(Question about usage really, wasn't sure whether to post this on StackOverflow. I didn't find any ember-jsonapi-resources questions or tags there, so asking here. Happy to update the README accordingly afterwards, if relevant for documentation)
I have a rails api using JR, with a /proposals
endpoint for a Proposal resource/model. I'm building a form for a new proposal on my ember front-end, and after installing ember-jsonapi-resources I generated a resource with ember g resource proposal
.
I noticed the route generated and appended to router.js
is in the singular, which threw me off a bit - I was (naively, probably) expecting a route in the plural, matching the rails convention, and since the jsonapi convention is also to refer to resources in the plural.
What's the recommended way to structure routes, that will work most seamlessly with ember-jsonapi-resources/JR? The dummy app's routing structure seems a little fuzzy on this:
this.route('index', { path: '/' });
this.resource('post', { path: '/:post_id' }, function () {
this.route('detail', { path: '/' });
this.route('comments');
});
this.route('admin', function () {
this.route('index');
this.route('create');
this.route('edit', { path: ':edit_id' });
});
For the proposal
resource creation example, should a route for new
(or create
?) be nested under the singular proposal route like this?
this.route('proposal', function() {
this.route('new');
// # and then,
//this.route('edit'); ?
// # and possibly
//this.route('index'); ?
});
...Or does it simply not matter, and any route structure will work the same with both ember-jsonapi-resources and JR?