Need some help with NodeJS in general 😄

General Discussion

Suggested Topics

  • 4 Votes
    1 Posts

    We will be dropping support for nodejs 14.x in nodebb 3.x.

    Nodejs 14 will be out of maintenance in april 2023 and some of our dependencies no longer support it.

    You can see nodejs release schedule here

  • Need your help

    General Discussion
    0 Votes
    2 Posts

    If you want a completely empty home page, I suggest using the custom pages plugin and pointing your home page setting in the ACP to a blank custom page.

    Otherwise, you can use css

  • Needs advise

    General Discussion
    0 Votes
    7 Posts

    @yariplus @JasperNL, alternatively you can use Kimsufi, which belongs to OVH to 100%. The only difference is that the systems there are dedicated ones and not virtual machines. I also use one of these for my download server, which works quite alright.

    About Redis:
    The database size itself will increase the same way as others. More data = bigger database. For more infos check this out:

  • 1 Votes
    13 Posts

    Just using function syntactic sugar var hello = (name) => {....} 😄

    And this makes code clear in async flow

    async.waterfall([ (next) => { next(err, 'name') }, (name, next) => { next(err, 'final') } ], callback)
  • 0 Votes
    1 Posts

    Well, I have this issue that I need to do following things:
    1.Mongo Find
    2. Foreach
    3. MongoFind
    4 one more Foreach.

    because of asynchronaus mongo calls it is difficult to get proper result, however process.nextTick should handle this problem and still I have problem:

    function find(dbComm) {

    dbComm.forEach(function (current) { id= parseFloat(current.ID); db.anotherCollection.find({ ID: id}, function (error, result) { result.forEach(function (rank) { if (parseFloat(result.ID) == parseFloat(current.ID)) { rank.rank = 'Some calculations'; } }); }); });


    app.get('/someparams', function (req, res) {

    db.collection.find().sort({ "rank": order }).skip(pagenumber).limit(5, function (err, result) { process.nextTick(function () { find(result, function () { }) }); process.nextTick(function () { res.send(result); }); });

    And on client side I should recive an array where the rank equals 'Some Calculations'
    but unfortunetly it is not...
    However...! If I add setTimeout(function(){}) before res.send(result) (and res.send(result) will be placed inside setTimeout) it actually does work and on client side I recive data with "Some Calculations" but it is just timeout and it fails sometimes and client dont recive "Some Calculations"
    if I put process.nextTick instead of setTimeout it doesnt work and "Some calc..." are not sent.

    Something is beeing done eralier then it should (probably in forEach in find() function)
    and my question is how to deal with it? maybe I should put process.nextTick in different function ?