Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AWAIT #123

Closed
KitsuneDev opened this issue Mar 23, 2017 · 4 comments
Closed

AWAIT #123

KitsuneDev opened this issue Mar 23, 2017 · 4 comments

Comments

@KitsuneDev
Copy link

Hey guys, sorry, I'm new to NodeJS. Is there any way to await for a post call??

@Twisterking
Copy link

use bluebird to "promisify" the graph calls and use Promises instead of callbacks!

@juanarbol
Copy link

Or using Async await functions

@ffflabs
Copy link

ffflabs commented Jan 31, 2018

Like @Twisterking said, use bluebird to promisify fbgraph, then all methods will have their promisified async method with the Async suffix:

const Promise = require('bluebird'),
  graph = Promise.promisifyAll(require('fbgraph'));

graph.setVersion('2.11');
graph.setOptions({...some options...});

async function getFeed(page_id) {
   const feed = await graph.getAsync(`/${page_id}/feed`);
}

@CKanishka
Copy link

Thanks @ffflabs your solution helped a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants