Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

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

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.md
Octocat-spinner-32 example.js
Octocat-spinner-32 package.json
README.md

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
Something went wrong with that request. Please try again.