Discontinued. See lamernews-client by @bevacqua.
Install with npm:
npm install --save lamernews-api
Instantiates a new LamernewsAPI
object and set its root
property.
The root of the API. For example, if you want to use the API of EchoJS,
you have to set http://echojs.com/
as root
.
"use strict";
var LamernewsAPI = require("lamernews-api");
var api = new LamernewsAPI("http://echojs.com/api/");
Returns news asynchronously.
count
[Number]: How many news should be returned (default:30
, max:30
)start
[Number]: Return news starting atstart
(default: 0)type
[String]:top
orlatest
(default:latest
)
err
[Null, Error]response
[Object]
"use strict";
var LamernewsAPI = require("lamernews-api");
var api = new LamernewsAPI("http://echojs.com/api/");
var options = {
count: 5,
type: "top"
};
api.getNews(options, function onDone(err, response) {
if (err) {
throw err;
}
console.log(response.news);
});
Performs a asynchronous API query.
API signature. Please take a look at the source of Lamernews for documentation.
err
[Null, Error]response
[Object]
"use strict";
var LamernewsAPI = require("lamernews-api");
var api = new LamernewsAPI("http://echojs.com/api/");
var signature = "/login?username=sbruchmann&password=thisisnotmypassword";
api.query(signature, function onDone(err, response) {
if (err) {
throw err;
}
console.log(response);
});
From the repo root:
npm install
npm test