"facebook integration in node.js" Code Answer's
You're definitely familiar with the best coding language Javascript that developers use to develop their projects and they get all their queries like "facebook integration in node.js" answered properly. Developers are finding an appropriate answer about facebook integration in node.js related to the Javascript coding language. By visiting this online portal developers get answers concerning Javascript codes question like facebook integration in node.js. Enter your desired code related query in the search bar and get every piece of information about Javascript code related question on facebook integration in node.js.
facebook integration in node.js
const request = require('request-promise');
module.exports = (app) => {
// you'll need to have requested 'user_about_me' permissions
// in order to get 'quotes' and 'about' fields from search
const userFieldSet = 'name, link, is_verified, picture';
const pageFieldSet = 'name, category, link, picture, is_verified';
app.post('/facebook-search', (req, res) => {
const { queryTerm, searchType } = req.body;
const options = {
method: 'GET',
uri: 'https://graph.facebook.com/search',
qs: {
access_token: config.user_access_token,
q: queryTerm,
type: searchType,
fields: searchType === 'page' ? pageFieldSet : userFieldSet
}
};
request(options)
.then(fbRes => {
// Search results are in the data property of the response.
// There is another property that allows for pagination of results.
// Pagination will not be covered in this post,
// so we only need the data property of the parsed response.
const parsedRes = JSON.parse(fbRes).data;
res.json(parsedRes);
})
});
}
Source: lorenstewart.me
facebook integration in node.js
app.get('/facebook-search/:id', (req, res) => {
// you need permission for most of these fields
const userFieldSet = 'id, name, about, email, accounts, link, is_verified, significant_other, relationship_status, website, picture, photos, feed';
const options = {
method: 'GET',
uri: `https://graph.facebook.com/v2.8/${req.params.id}`,
qs: {
access_token: user_access_token,
fields: userFieldSet
}
};
request(options)
.then(fbRes => {
res.json(fbRes);
})
})
Source: lorenstewart.me
All those coders who are working on the Javascript based application and are stuck on facebook integration in node.js can get a collection of related answers to their query. Programmers need to enter their query on facebook integration in node.js related to Javascript code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about facebook integration in node.js for the programmers working on Javascript code while coding their module. Coders are also allowed to rectify already present answers of facebook integration in node.js while working on the Javascript language code. Developers can add up suggestions if they deem fit any other answer relating to "facebook integration in node.js". Visit this developer's friendly online web community, CodeProZone, and get your queries like facebook integration in node.js resolved professionally and stay updated to the latest Javascript updates.