Monday 23 April 2018

Questions about node..coming from php

Hey everyone, I just wanted to get some thoughts from developers who are using node more professionaly than myself.I find myself having great difficulty getting around the async situation. I've written a simple app in node, but I find myself using promises frequently. So that I have a string of .then() essentially making things seem syncronous. Is this common? Is this how you handle data in node? Or is it more common(the only other way I see) to create multiple routes to get different data elements and handle most of that via forms and ajax requests on the client side. Example App.get('articledata',function(stuff){dostuff(stuff)}App.get('adData',function(stuff){dostuff(stuff)}Etc etc2. Whenever I look at for support on stackexchange or elsewhere first advice is to npm another module. Is this common practice to have multiple modules for even simple apps.I wrote a blog app but I found myself including Express, body-parser, cookie-parser, JWT mySql, and md5.And from that I have over 1 hundred modules now, mostly from express.Is this normal, or am I doing something wrong? I really don't like seeing a project and 99% of my code not being my code. And it seems like a debug hell if I ever run into a problem. Hundreds of dependencies to look through.

Submitted April 23, 2018 at 11:39PM by freakwoods

No comments:

Post a Comment