I recently started my first project in node.js, and I'm struggling with my code. I was always used to languages like Java or frameworks like Angular, where more or less the code respects the classical oop paradigm, but with node I realize that it's not always the good way, even with typescript. I tried to think in oop but I'm not confortable, at least in my specific case.
All this asyncronous stuff, both with callback functions and/or promises sometimes make me feel like my code becomes quickly spaghetti. So I am asking you guys if you could please link some good tutorial or some codebase with nice examples of how to use asynchronous stuff in a clean way.
I'll keep looking on github for the source code of some famous library/framework and try to study them, but some tutorial would be nice...
Thanks in advance.
Fernando Doglio
Dev Advocate - ex Technical Manager - Technical Author - All around geek
The logic behind JavaScripts paradigm might be confusing to some at first, I totally understand you! It's not fully OOP, and it's not fully functional, although from what you said, I would recommend checking out some functional programming articles. They might help you better deal with callbacks. That being said, if you want to focus on OOP (which is perfectly normal), I recently wrote an article showing how to implement some of the common design patterns in JS: blog.logrocket.com/design-patterns-in-node-js I hope that helps clear things up a bit!