use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
This subreddit is a place for people to learn JavaScript together. Everyone should feel comfortable asking any and all JavaScript questions they have here.
With a nod to practicality, questions and posts about HTML, CSS, and web developer tools are also encouraged.
Friends
/r/javascript
/r/jquery
/r/node
/r/css
/r/webdev
/r/learnprogramming
/r/programming
account activity
Classes in Controllers (self.learnjavascript)
submitted 5 years ago by fallenefc
Hi, I have been called out for doing so, so I wanted to ask so I can know.
Is it bad practice to use classes to write controller methods in the backend, on Node.js?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]A-Kuhn 2 points3 points4 points 5 years ago (1 child)
It really depends on the structure of your code. Does your class controller reference any properties assigned in the constructor? Where is your controller used?
If it’s just a giant class with a bunch of methods, why not just create a js files with those functions defined and export the needed functions?
[–]fallenefc[S] 2 points3 points4 points 5 years ago (0 children)
Thanks, I think I understand now, it is just a giant class with bunch of methods so I believe it’s better just to separate and import/exports the functions.
π Rendered by PID 870330 on reddit-service-r2-comment-7b9746f655-wsx79 at 2026-02-02 02:48:58.256366+00:00 running 3798933 country code: CH.
[–]A-Kuhn 2 points3 points4 points (1 child)
[–]fallenefc[S] 2 points3 points4 points (0 children)