npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ccnode

v3.0.5

Published

cnodejs sdk

Downloads

5

Readme

cnode社区开放接口sdk

快捷方便统一。

接口命名

TOPICS:

  1. getTopics: get /topics 获取主题首页
  2. getTopic: get /topic/:id 主题详情
  3. postTopics: post /topics 新建主题
  4. postTopicsUpdate: post /topics/update 编辑主题

USER:

  1. getUser: get /user/:loginname 用户详情
  2. postAccessToken: post /accesstoken 验证 accessToken 的正确性

MESSAGE:

  1. getMessageCount: get /message/count 获取未读消息数
  2. getMessages: get /messages 获取已读和未读消息
  3. postMessageMarkall: post /message/mark_all 标记全部已读

COLLECT:

  1. postCollect: post /topic_collect/collect 收藏主题
  2. postDeCollect: post /topic_collect/de_collect 取消主题
  3. getLoginnameCollect: get /topic_collect/:loginname 用户所收藏的主题

REPLY:

  1. postTopicReplies: post /topic/:topic_id/replies 新建评论
  2. postReplyUps: post /reply/:reply_id/ups 为评论点赞

安装和使用

npm install ccnode --save

cnodejs社区api参数参考:https://cnodejs.org/api

公共参数:

const options = {
  accesstoken: 'xxxx'
}

ES5:

promise使用:

var cnode = require('ccnode');
var topics = new cnode.TOPICS(options);
topics.postTopics({
  title: 'test',
  tab: 'test',
  content: 'api_sdk_test'
}).then(function(res){
  // xxxx
}).catch(function(err){
  // xxx
});

callback使用:

var cnode = require('ccnode');
var topics = new cnode.TOPICS(options);
topics.postTopics({
  title: 'test',
  tab: 'test',
  content: 'api_sdk_test'
}, function(res){
  // xxx
})
// 带参数的接口,比如/topic/:topic_id,需要自己写host
topics.getTopic({mdrender: true, host: 'topic/5433d5e4e737cbe96dcef312'}, (res) => {
  console.log(res);
});

ES7:

import {TOPICS} from 'ccnode';
const topics = new TOPICS(options);
// Within Async Func
(async() => {
  try {
    const result = await topics.postTopics({
      title: 'test',
      tab: 'test',
      content: 'api_sdk_test'
    });
    return result;
  } catch (e) {
    console.log(e);
  }
})();