Using routes to perform actions


#1

Hi,

I am curious to know how far other people take the use of routes. With the transition retry and afterModel() and so on. I find it’s easy to have a route that “does” something, then immediately leave the route on success.

For instance, if I have a room planner. Is it an anti-pattern to have a child route that adds an item to the room, then exit back out of the child route. Or an equivalent, perhaps to add to a list.

You could have http://mywebsite.com/addanitem/2 then it adds an item “2” to a list and then the route handles the decision about whether to come out maybe based on the return value of the operation, or whether the data has been fetched correctly and so on.

I saw this but wondered whether it is taking routes too far.