I tried to use resources on my current project, hoping to standardize conventions for the CRUD portion of the site. The basic resource routing works fine. But if I need to add an additional non-resourceful function, such as "upload", routing fails. I would expect the resourceful router to fall back to :handler/:action if it gets a URL that doesn't conform to one of the 6 standard "resources".
This is not an API, it's a handler/view site. I know that resourceful routing wasn't designed for this situation, but it seems like a good idea to use resourceful routing conventions for all of the basic CRUD functionality and still be able to use :handler/:action for additional functionality. Using dropzone to upload a file, and CRUD resources to deal with the metadata is a good example of this situation in the case of client-side, API-based file management. I would want to keep all of this logic in a single handler but I can't do that with the current resource definitions.
More info here: https://boxteam.slack.com/archives/C0532LKQ3/p1592323979366800
in order for me to verify, reproduce or offer something, you need to put exactly the routing you are using. I cannot assume or deduce what you are trying to do here. So please make sure you add full examples in the ticket.
This is my routing.cfc. All you need to do is create a resourceful handler for any of these and try adding an “upload”, or any other non-resourceful, action as described in the slack link I sent. I was trying to upload a spreadsheet containing a list of names using the MailingLists handler when I posted that.
The issue is that the resourceful routes enter a /resource/:id route. Which will match anything coming on that placeholder. So there is no way for it to assume that’s an action or an id. You will have to register specific routes in order to do what you are trying to do. remember that they fire in order.
Use the route-visualizer module so you can visualize the issue.