Skip to content

Latest commit

 

History

History
56 lines (40 loc) · 969 Bytes

README.md

File metadata and controls

56 lines (40 loc) · 969 Bytes

lamernews-client

A simple Node.js client to the LamerNews API

Installation

npm i -S lamernews-client

Usage

The example shown below will post some news to a LamerNews-powered site, and remove them afterwards.

var lamer = require('lamernews-client');
var client = lamer.createClient({ api: 'http://www.echojs.com' });

client.login({
  username: '{{username}}',
  password: '{{password}}'
}, logged);

function logged () {
  client.submit({
    title: 'testing lamernews-client!',
    url: 'https://github.com/bevacqua/lamernews-client'
  }, remove);
}

function remove (err, data) {
  client.remove(data, done);
}

function done (err) {
  t.end();
}

Just want a list of new articles posted on EchoJS?

var lamer = require('lamernews-client');
var client = lamer.createClient({ api: 'http://www.echojs.com' });

client.list({}, listed);

function listed (err, body) {
  console.log(err, body);
  t.end();
}

License

MIT