http - Synchronous Blocks in Node.js -
i want know if it's possible have synchronous blocks in node.js application. i'm total newbie node, couldn't find answers behavior i'm looking specifically. my actual application little more involved, want support request , post request. post request append item array stored on server , sort array. request return array. obviously, multiple gets , posts happening simultaneously, need correctness guarantee. here's simple example of code theoretically like: var arr = []; app.get(/*url 1*/, function (req, res) { res.json(arr); }); app.post(/*url 2*/, function (req, res) { var itemtoadd = req.body.item; arr.push(itemtoadd); arr.sort(); res.status(200); }); what i'm worried request returning array before sorted after item appended or, worse, returning array as it's being sorted. in language java use readwritelock. i've read node's asynchrony, doesn't appear arr accessed in way preserves behavior, i'd love proven wr...