disqus-server-client-core
TypeScript icon, indicating that this package has built-in type declarations

0.0.7 • Public • Published

Disqus Server Client - Core

Core client that helps your server to connect to the Disqus API.

Features

The Disqus API - although not very documented - is very easy to implement. This implementation has a view advantages:

  • Implemented using TypeScript, so we have types and you have auto-complete
  • Uses Axios which gives use Promises, so you can use async and await
  • Uses Node Cache to cache some endpoints, so your performance is better.

API

Let's show some code.

New up a client:

// Node.js
const { DisqusCode } = require("disqus-server-client-core")
 
// Or TypeScript:
import { DisqusCore } from 'disqus-server-client-core'
 
const config = {
    accessToken: "...",
    apiKey:      "...",
    apiSecret:   "..."
}
 
const disqus = new DisqusCore(config)

Getting the posts:

const r = await disqus.request("posts/list", { forum: "keestalkstech" })
const posts = r.response.map(post => ({
    msg: post.msg,
    by: post.author.name || post.author.username,
    thread: post.thread
}))
 
console.log(posts);

Getting the details of a thread:

const id = "...";
const r = await disqus.request("threads/details", { thread: id })
const thread = {
    title: r.response.title,
    url: r.response.link,
};
 
console.log(title);

What actions can I do?

You can find them here: https://disqus.com/api/docs/

Maintenance

This project is maintained by Kees C. Bakker.

Keywords

Install

npm i disqus-server-client-core

DownloadsWeekly Downloads

5

Version

0.0.7

License

MIT

Unpacked Size

16.1 kB

Total Files

17

Last publish

Collaborators

  • keestalkstech