lamernews-api
Installation
Install with npm:
npm install --save lamernews-api
API
new LamernewsAPI(root);
Instantiates a new LamernewsAPI
object and set its root
property.
Parameters
root
(required) [String]
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
.
Usage
"use strict"; var LamernewsAPI = ; var api = "http://echojs.com/api/";
LamernewsAPI#getNews(options, callback)
Returns news asynchronously.
Parameters
options
(optional) [Object]
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
)
callback(err, response)
(required) [Function]
err
[Null, Error]response
[Object]
Usage
"use strict"; var LamernewsAPI = ; var api = "http://echojs.com/api/";var options = count: 5 type: "top"; api;
LamernewsAPI#query(signature, callback)
Performs a asynchronous API query.
signature
(String)
API signature. Please take a look at the source of Lamernews for documentation.
callback(err, response)
(required) [Function]
err
[Null, Error]response
[Object]
Usage
"use strict"; var LamernewsAPI = ; var api = "http://echojs.com/api/";var signature = "/login?username=sbruchmann&password=thisisnotmypassword"; api;
Testing
From the repo root:
npm install
npm test