Create a new instance of WPCOM. token
parameter is optional but it's needed to
make admin actions or to access to protected resources.
Note: You can use the [node-wpcom-oauth][] module to get an access token.
Create a Me
object. More info in Me doc page.
var wpcom = require('wpcom')('<your-token>');
var me = wpcom.me();
});
Create a Site
object. More info in Site doc page.
var wpcom = require('wpcom')('<your-token>');
var site = wpcom.site();
View Freshly Pressed posts from the WordPress.com homepage.
wpcom.freshlyPressed(function(err, data){
if (err) throw err;
console.log('"Freshly Pressed" Posts:');
data.posts.forEach(function (post) {
console.log(' %s - %s', post.title, post.short_URL);
});
});