Skip to content

fczuardi/node-forrst

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-forrst

Simple node.js wrapper for the Forrst.com API.

Work in progress...

Installation

npm install forrst

Usage

This wapper is at the moment basically an extension of Node.js’s http.get method, below are 2 basic examples of how to use it:

Calling the stats method

var forrst = require('forrst');

forrst.stats(function(res){
  res.on('data', function(d) {
    process.stdout.write(d);
  });
  res.on('end', function(d) {
    console.log('\n\n[request completed]');
  });
}).on('error', function(e) {
  console.error(e);
});

The stats method is the only one that don't accept parameters, so the only argument to pass to forrst.stats is the callback function.

For all other methods you pass an object containing the method parameters as the first argument and the callback function as the second argument, see the example below:

Calling any other method

var forrst = require('forrst');

forrst.posts.list({post_type:'snap'}, function(res){
  console.log("headers: ", res.headers);
  res.on('data', function(d) {
    process.stdout.write(d);
  });
  res.on('end', function(d) {
    console.log('\n\n[request completed]');
  });
}).on('error', function(e) {
  console.error(e);
});

The method names use dots instead of slashes, so posts/list become posts.list

Implemented Methods

License

  • MIT

TODO / Roadmap

  • require from the developer a custom user-agent
  • add authenticated calls
  • flip the calls to https

About

Simple node.js wrapper for the Forrst.com API (http://forrst.com/api).

Resources

License

Stars

Watchers

Forks

Packages

No packages published