News for hackers. Stuff that matters.
Re:Node v7.5.0 Released by athenot on Friday February 03, 2017 @10:22AM (#13560339)
This is probably not the answer you're looking for, but you could look into ways that make callbacks enjoyable. The syntactic sugar provided by CoffeeScript goes a long way to make readable (and, dare I say, elegant) what would be a tangled mess in straight up JavaScript:

  # Get profiles LIST as JSON
  .post "/list", (req, res) ->
    db.maria.query getProfilesQuery, { userId: req.session.passport.user }, false
      .on "result", (result) ->
        rows = []
        res.status(200)
        result
          .on "row", (row) -> rows.push row
          .on "error", (error) -> logger.warn error
          .on "end", -> 
            res.json rows
            res.end()
5 callbacks here but they don't impede readability.
Re:Node v7.5.0 Released by Mahn on Friday February 03, 2017 @10:28AM (#13560404)
Maybe it's just me, but this would look infinitely more readable to me if I could tell where each callback starts and where it ends, i.e. in plain JavaScript.
Re:Node v7.5.0 Released by always_good on Friday February 03, 2017 @11:05AM (#13560732)
What impedes readability here is that you don't simply have an async function `getProfiles({ userId })` that gives you a list of profiles, either taking a callback or returning a promise.

A lot of that is pointless noise. You don't need to set the status code to 200 or call end(). `res.json(profiles)` will do.

And these days, Coffeescript is just Javascript with some optional parens. Can't think of many upsides in 2017 to not just using ES6.