Hi,
I am writing an application using the MERN stack.
I find myself repeating the same controllers through my application read, list, delete, etc.
A lot of the code is repeated. I am wondering if anyone has a suggested work around. At first I thought classes - but with node I I understand that those are now discouraged and a more functional programming - however I am lost - does anyone have an example of what a class / object type approach would be for creating controllers that you could just pass the data through by way of functions? I would love to see how that might look like in practice … rather than rewriting pretty much the same list, read, create controllers for all of my different routes
Maybe like a controller function helper where you just pass the controller in for by way of parameters ?
In PHP I had a class called DB helpers and used it that way – passing in my parameters.- has anyone made anything like that with node and are able to share.
thx!
Karen