Closed pnw closed 7 years ago
Example router.js
this.route('users', function () { this.route('users', {path: '/'}) // explicit index with custom name - /users this.route('user', {path: '/:user_id'}, function () { this.route('user', {path: '/'}) // explicit index with custom name - /users/1 this.route('widgets', {path: '/widgets'}, function () { this.route('widgets', {path: '/'}) // explicit index with custom name - users/1/widgets this.route('widget', {path: '/:widget_id'}) // users/1/widgets/2 }) }) }) this.route('widgets', function () { // implicit index - /widgets this.route('widget', {path: '/widget_id'}) // /widgets/1 })
Corresponding file structure
routes/ users/ users.get.js users.post.js user/ user.get.js user.put.js user.delete.js widgets/ widgets.get.js widgets.post.js widget.get.js widget.put.js widget.delete.js widgets/ index.get.js index.post.js widget.get.js widget.put.js widget.delete.js
Example router.js
Corresponding file structure