Should you create routes for new/edit/delete actions?

Hi, I have a model that users will be able to create, edit and delete. Currently I have these created as actions on the controller and then handlebars {{if isEditing}} etc. to toggle the different states. This approach has zero affect on the URL.

Would you recommend creating routes for these create/edit and delete actions instead? If so, why?

Usually, people pop out a form for the edit and new routes. I like breaking them out into routes for bookmark-ability. You can stay in the same route, but I wouldn’t call one approach better than the other, because its a choice that depends so heavily on the UI.

@ulisesrmzroche is right on. Route trees have more to do with UI concerns than functionality. A pattern you might use is a single display route that has components that turn fields into “edit mode” when double clicked. Alternatively, I get a lot of mileage out of /new and edit/:id routes (delete would be handled as an action on the edit route).

@oskar It depends on the Usability and your user or audience needs.

If your app is a single page web-app and if you have separate route for different pages, then it will be better to load your new/edit inside a dialog or form.( TO prevent full change in the UI when the Route changes.)

Delete can be handled as an action inside your respective Route. If the delete action is common to all the Routes then it can be handled in Application Route.