Hey guys I have a question regarding the best way of performing CRUD operations on my models when I may only need a create operation or update for some things...
When data is posted, should I always have a relevant resourceful controller to handle the request or is it ok to have a generic controller that handles a variety of http requests that on a particular method, collects the input and after validating passes the data to a relevant service for parsing and persisting?
Trying to put a finger on the best practice for this sort of stuff.
Well it depends on the size of your application. I always like to keep everything organized and therefor I keep every CRUD action on it's own method in a specific controller on that subject. However it's find if you don't want to do that.
As you can see something and nothing are not related to each other like user/create and user/update and therefor they don't belong to each other. But if you have a few of these functions and routes you maybe want to create a single controller to group them instead of creating multiple controllers.
Now I always have a controller for pages, then I can still group stuff while they can be anything. This might work for you as well.