Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9001689
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:28:12+00:00 2026-06-16T00:28:12+00:00

I am building an Express Node.js appication using this Facebook SDK , and here

  • 0

I am building an Express Node.js appication using this Facebook SDK, and here is my current route for root:

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

    req.facebook.api('/me', function(err, user) {

        res.render('index', {title: 'title', user: user});

    });


});

I am making a call to the FB open graph URL http://graph.facebook.com/me, but I’d like to make multiple open graph calls to pass to my template. For example:

var APIcalls = ['/me', '/me/music', '/me/music.listens'];

req.facebook.api(APIcalls, function(err, res1, res2, res3){

    res.render('index', {res1: res1, res2: res2, res3: res3});

});

What is the easiest way to make multiple API calls to Facebook and then pass the responses to my template accordingly? You can see my full app.js file here. Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T00:28:13+00:00Added an answer on June 16, 2026 at 12:28 am

    This scenario seems perfect for async.map
    see here: https://github.com/caolan/async#map

    the async.map method takes an array of items and performs the same async call for each item in your array in parallel. If no errors are encountered, it will call a callback with a new array of results.

    so your example would look something like this:

    var async = require('async'),
        APIcalls = ['/me', '/me/music', '/me/music.listens'];
    
    async.map(APIcalls, 
      function(item, callback){
        req.facebook.api(item, function(err, user) {
          if(err){
            return callback(err); 
          };
          callback(null, user);
      });},
      function(err, results){
        if(err){
          throw new Error(err);
        }
        res.render('index', results);
      }
    );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am building a todo app using express framework on node server...I have an
I am building an app on node.js using express, and node-mysql driver. There is
I am building a website/app using node.js, express and nowjs. Once user log into
I'm currently building a web app using Node.js and Express.js . I'm looking for
I'm building an app with backbone/RequireJs on the front end and node/express on the
I've been looking into building a REST api using the Azure SDK for node
I am building a Node Express application using Jade, and I am confused about
Building my first serious Node.js project (using Express). I need to use several calls
I'm following this tutorial about building a blog with node.js, express and mongodb. The
I am building a web app with express.js in the back- and backbone.js in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.