-
Notifications
You must be signed in to change notification settings - Fork 11
Home
tcr edited this page Mar 15, 2013
·
38 revisions
Rem is an extensible HTTP client with middleware for Node.js and browsers. Built to power anything REST client, Rem comes with support for popular web services out of the box.
- Making HTTP Calls and Middleware with Rem
- Creating an API client using Rem
- Using Rem's OAuth middleware with Express
- Saving and restoring user's access tokens
- API Reference
Rem can make any kind of HTTP request:
rem.json('http://graph.facebook.com/timcameronryan').headers({
'X-Custom-Header': '1'
}).get(function (err, content, res) {
if (err) {
console.error(err);
} else {
console.log('Returned this JSON:', content);
}
})
In addition to json
, Rem supports returning content as a stream
, buffer
, text
, xml
(with libxmljs), and form
data.
Rem is customizable for making simple API clients. For example, to make a Tumblr library:
var tumblr = rem.createClient({
"base": "http://api.tumblr.com/v2",
"configParams": {"api_key": "key"},
"uploadFormat": "form"
}).configure({
"key": process.env.TUMBLR_KEY
});
// Get info about the "staff" blog
tumblr('blog', 'staff.tumblr.com', 'info').get(function (err, json) {
console.log('Response', json);
});
Rem can authenticate users using OAuth and tokens can be saved and restored for running scripts.
Rem comes with support for a number of APIs built-in, which you can access with the rem.connect(...)
method. Read the code examples for more information.