Git Product home page Git Product logo

node-disqus's Introduction

Disqus - An API module for Node.js

This module allows you to use the Disqus API. The module is written for version 3.0 of the API and uses the 'Legacy admin authentication' instead of OAuth.

Install

npm install disqus

Use

Setup

Here's how to set it up:

var Disqus = require('disqus');

var disqus = new Disqus({
    api_secret : 'your_api_secret',
    api_key : 'your_api_key',
    access_token : 'your_access_token'
});

From then on you can use the request method to make calls to the API. Note that the module knows if it should use GET or POST, so you don't need to worry about that.

Request method

The request method has three parameters:

disqus.request(resource, parameters, callback);

resource maps to one of the API methods, so for example the list method for posts is written as posts/list in the argument.

parameters are required but can be an empty object ({}) if you don't have any.

callback will contain either the response of the call if it went successful. If you got an error, it will contain an error property with error information.

Example

Here's an example that will list all posts from a forum called 'foo'. This example requires that the disqus object is already setup with your credentials, as shown in the 'setup' example above.

disqus.request('posts/list', { forum : 'foo'}, function(data) {
    if (data.error) {
        console.log('Something went wrong...');
    } else {
        console.log(data);
    }
});

Notes

node-disqus's People

Contributors

hay avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.