DEV Community

loading...

Discussion on: Understanding MVC pattern in Nodejs

Collapse
727021 profile image
Andrew Schimelpfening

This is a great example of MVC with Node.
What’s the reasoning behind exporting a class with all static methods instead of just exporting the methods themselves?

Collapse
eaetukudo profile image
Emmanuel Etukudo Author

It simply developer preference, The first thing that came to mind was the "Don't Repeat Yourself (DRY)" approach. Exporting each method can as well become verbose. Let me know if you can improve the code. Thanks.

Collapse
osairisali profile image
AAH

I think exporting a class with all its methods is quite bulky if we only need one or two of them. Security concern might also exposed. Anyway, it's a good article 👍 Thank you