Need private packages and team management tools?Check out npm Teams »

stackexchange

1.2.0 • Public • Published

Stackexchange API for Node.js

Implementation of all stackexchange methods to query questions and awesome answers.

Installation

npm install stackexchange --save

Usage

var stackexchange = require('stackexchange');
 
var options = { version: 2.2 };
var context = new stackexchange(options);
 
var filter = {
  key: 'YOUR_API_KEY',
  pagesize: 50,
  tagged: 'node.js',
  sort: 'activity',
  order: 'asc'
};
 
// Get all the questions (http://api.stackexchange.com/docs/questions)
context.questions.questions(filter, function(err, results){
  if (err) throw err;
  
  console.log(results.items);
  console.log(results.has_more);
});
 
// Get results for a different website within the stackexchange network
filter.site = 'softwareengineering';
context.questions.questions(filter, function(err, results){
  if (err) throw err;
  
  console.log(results.items);
  console.log(results.has_more);
});
 
// Get all users
context.users.users(filter, function(err, results){
  if (err) throw err;
 
  console.log(results.items);
  console.log(results.has_more);
});

Install

npm i stackexchange

DownloadsWeekly Downloads

47

Version

1.2.0

License

MIT

Unpacked Size

27.7 kB

Total Files

19

Last publish

Collaborators

  • avatar
  • avatar