1.0.7 • Published 10 years ago

cnodejs v1.0.7

Weekly downloads
3
License
ISC
Repository
github
Last release
10 years ago

cnode api && 快速发布README.md到cnode

client for https://cnodejs.org/api

gitter NPM version Build codecov.io js-standard-style

  • create topic
  • update topic
  • 支持cli把markdown发布到cnode(首次为创建,以后为修改)

Install

$ npm i -g cnodejs

需要在环境变量配置用户的cnode token

Usages

cli

快速发布README.md到cnode,只需要2步

1) 需要在环境变量配置用户的cnode token

export CNODE_TOKEN=xxx

2) 执行cnode命令,默认文件是README.md

Usage: cnode [options]

Options:
  --file, -f  choose a file, default README.md
  --open, -o  open in browser
  -h, --help  Show help                                                [boolean]

如果第一次发布成功,会生成.cnode.json文件作为缓存文件,以后再次执行cnode命令会更新。

api

$ npm i -S cnodejs

then

var api = require('cnodejs')

if (!process.env.CNODE_TOKEN) {
  api = require('cnodejs')('3d5ba965-747e-45ab-b879')
}

create topic

api.create('cnodejs api测试信息请忽略', '我是用来测试的,请忽略')
  .then(function(response){
    console.log(response)
  }).catch(function (err) {
    console.log(err)
  })

update topic

var topic = {
  topic_id: '57eb2ab8ea2fa420446d4366',
  title: 'cnodejs api updated2',
  content: 'cnodejs api updated',
  tab: 'share'
}

api.update(topic)
  .then(function(response){
    console.log(response)
  }).catch(function (err) {
    console.log(err)
  })

说明: topic_id 为必选项,目前api中其他参数不填即为空

针对于使用cnode建立的站点

export CNODE_URL=xxx

Debug

$ DEBUG=cnode cnode

Reffer

1.0.7

10 years ago

1.0.6

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago