Search code examples
javascriptnode.jsasynchronousibm-cloud

How Do I Async Parallel Multiple app.use Calls?


How do I async parallel multiple app.use calls? I've read https://github.com/caolan/async and I've seen:

async.parallel([
    function(){ ... },
    function(){ ... }
], callback);

But I'm not quite sure how to use it with the following:

app.use('/api/users', api.users);
app.use('/api/score', api.score);
app.use('/api/payment', api.payment);
app.use('/api/ci',api.ci);
app.use('/api/db', api.concepts);
app.use('/api/swing', api.swing);
app.use('/api/list', api.list);

Solution

  • app.use('/api/users', api.users) is not an asynchronous code. It just assign api.users to handle request with paths matching /api/users. You don't need to use async.parallel for this.