Doing multiple client's petitions one by one in Node.JS using serialport

I am using SerialPort2 and Express in Nodejs

I am building a web api that receives petitions of multiple clients. All of this clients are accesing one serial port device.

I need a way to execute all my clients tasks one by one. SCENARIO(a family with multiple devices accesing one serial device)

I have read about control flow, Should I use Serial- control flow?

Also I am reading about this library: https://github.com/creationix/step

Thanks, Nice day!!!

You can use async queue to build a queue that executes tasks serial. This example is a slight variation of the queue example given on the async github site:

var q = async.queue(function (task, callback) {
    console.log('hello ' + task.name);
    callback();
}, 1); // set concurrency for serial execution

q.push({name: 'bar'}, function (err) {
    console.log('finished processing bar');
});

Note that you're not limited to objects that can be pushed to the queue you can also push functions that interact with the serial interface.